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
Why scanner is used in java?
What is quick sort in java?
Why constructor has no return type?
What is a Hash Table? What are the advantages of using a hash table?
What data type is true or false?
What is string length in java?
What is jit and its use?
Can a static member function access member variable of an object?
Does importing a package imports its sub-packages as well in java?
What is polymorphism java example?
Can we access instance variables within static methods ?
How strings are created in java?
why are wait(), notify() and notifyall() methods defined in the object class? : Java thread
What is a finally block? Is there a case when finally will not execute?
What are invisible components?.