there are some duplicate values in ArrayList, how U'll get
that array with out duplicate?
Answer Posted / sai
ArrayList list = new ArrayList();
list.add("a");
list.add("b");
list.add("a");
list.add("c");
list.add("b");
HashSet set = new HashSet(list);
list.clear();
list.addAll(set);
System.out.println("ArrayList : ");
for (Object data : list) {
System.out.println(data);
Is This Answer Correct ? | 13 Yes | 2 No |
Post New Answer View All Answers
Is integer passed by reference in java?
Why chararray() is preferred over string to store the password?
What is the role of the java.rmi.naming class?
What are java packages?
Are global variables initialized to zero?
What is java autoboxing?
explain what is transient variable in java?
How can we create a synchronized collection from given collection?
What is == mean?
Explain what pure virtual function is?
what is the difference between the methods sleep() and wait()? : Java thread
Why singleton is not thread safe?
What is a constructor, constructor overloading in java?
What is string made of?
How does predicate work in java?