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


Please Help Members By Posting Answers For Below Questions

What about abstract classes in java?

606


What are scalar data types?

520


What is java objectoutputstream?

539


Give few examples of final classes defined in Java API?

698


What is a type parameter in java?

526






What is a singleton in genetics?

558


What is a local, member and a class variable?

574


Why is multithreading important?

488


Can abstract class have private constructor?

494


What is a boolean field?

523


what is singleton class in java?

617


What is the difference between choice and list?

588


How do you check if two given string are anagrams?

551


Does java runtime require a license?

574


What is exception in java?

563