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 tochararray in java?
Give a practical example of singleton class usage?
What's the difference between an abstract class and interface in java?
What is argument in java?
Can a class be defined inside an interface?
Can we extend singleton class?
What is a method in java?
what is comparable and comparator interface?
How does hashmap work in java ?
Explain different forms of polymorphism?
How many wrapper classes are there in java?
What is public static void main?
When is the arraystoreexception thrown?
Can you instantiate the math class?
When do we use hashset over treeset?