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 is the difference between Object Based Language and Object Oriented Language?

825


How do you check if a string contains only numeric digits?

906


What is the difference between JVM and JRE?

849


List some features of the abstract class.

816


What is class variable java?

814


What is tostring () method?

784


What is the common usage of serialization? What exceptions occur during serialization?

851


What is the difference between class & structure?

836


why would you use a synchronized block vs. Synchronized method? : Java thread

771


What is the base class of all exception classes in java?

834


Q1.A. Write note on “The class path Environment Variable”? B. Which are different kinds of source code? Q2.A. How to create an interface? B. Why convert an applet to an application? Q3.A. How to use Media tracker Class. B. How to use string tokenizer class. Q4 A. Explain the overview of UDP messaging. B. Difference between SQL Exception class and SQL Warning class. Q5. A. How to create com object in Java? B. Write short notes on “The properties class” Q6. A. When object is created and destroyed? B. Explain the JDB in depth & command line. C. Write short notes on Web Sites.

7925


Can we modify the throws clause of the superclass method while overriding it in the subclass?

816


What is function overriding and overloading in java?

843


What is used of static keyword in java?

811


What is the r character?

826