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 environment variables are required to be set on a machine in order to run Java programs?

612


What does singleton class mean?

531


How to make a write-only class in java?

570


What is the difference between Java1.4 and Java1.5

1823


How can I become a good programmer?

486






What is the use of parse function in java?

509


What is time complexity java?

532


Why doesn't the java library use a randomized version of quicksort?

541


What is the default size of load factor in hashing based collection?

558


What is import java util arraylist?

650


how its run?

563


What is difference between null and void?

525


Why is a string immutable?

539


What is static method with example?

612


What is a ternary operator in java? What is an interface?

546