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 about abstract classes in java?
What are scalar data types?
What is java objectoutputstream?
Give few examples of final classes defined in Java API?
What is a type parameter in java?
What is a singleton in genetics?
What is a local, member and a class variable?
Why is multithreading important?
Can abstract class have private constructor?
What is a boolean field?
what is singleton class in java?
What is the difference between choice and list?
How do you check if two given string are anagrams?
Does java runtime require a license?
What is exception in java?