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
What environment variables are required to be set on a machine in order to run Java programs?
What does singleton class mean?
How to make a write-only class in java?
What is the difference between Java1.4 and Java1.5
How can I become a good programmer?
What is the use of parse function in java?
What is time complexity java?
Why doesn't the java library use a randomized version of quicksort?
What is the default size of load factor in hashing based collection?
What is import java util arraylist?
how its run?
What is difference between null and void?
Why is a string immutable?
What is static method with example?
What is a ternary operator in java? What is an interface?