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


Please Help Members By Posting Answers For Below Questions

What is a parent class in java?

549


What is the difference between char and char *?

567


What is a short in java?

504


Explain about public and private access specifiers?

538


What is mean by encoding?

627






What does string mean in java?

630


What is multi-catch block in java?

620


What are class members by default?

663


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

1601


What are the high-level thread states in java programming?

589


How to find the index of the largest number in an arraylist java?

522


What are synchronized methods and synchronized statements in java programming?

577


How to restrict a member of a class from inheriting by its sub classes?

805


What does ide stand for?

523


What are the benefits of immutable objects?

542