there are some duplicate values in ArrayList, how U'll get
that array with out duplicate?
Answer Posted / phani raju
ArrayList list = new ArrayList();
list.add("a");
list.add("b");
list.add("a");
list.add("c");
list.add("b");
LinkedHashSet lset = new LinkedHashSet
(list);
list.clear();
list.addAll(lset);
System.out.println("ArrayList : ");
for (Object data : list) {
System.out.println(data);
| Is This Answer Correct ? | 5 Yes | 0 No |
Post New Answer View All Answers
What is multithreading in java?
What do you mean by light weight and heavy weight components?
What is the difference between a loader and a compiler?
we have syntax like for(int var : arrayName) this syntax is to find whether a number is in the array or not.but i want to know how to find that number's location.
If a class is declared without any access modifiers, where may the class be accessed in java programming?
What is string builder in java?
What is protected access modifier?
What is %d in printf?
Can we have any code between try and catch blocks?
a thread is runnable, how does that work? : Java thread
What is a private class in java?
What is this keyword used for?
Tell me about your ability to work under pressure
how to convert Java project into Maven ?
What are the important features of Java 8 release?