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 is a parent class in java?
What is the difference between char and char *?
What is a short in java?
Explain about public and private access specifiers?
What is mean by encoding?
What does string mean in java?
What is multi-catch block in java?
What are class members by default?
I am unable to find or learn about print command. I have a graphical program in core java in applet but i want to give print command but i have coding for that so if anyone know about this plz mail me on avdhesh_chauhan007@yahoo.co.in
What are the high-level thread states in java programming?
How to find the index of the largest number in an arraylist java?
What are synchronized methods and synchronized statements in java programming?
How to restrict a member of a class from inheriting by its sub classes?
What does ide stand for?
What are the benefits of immutable objects?