I have a Arraylist object, it has duplecate values also. Now
question is i want delete duplecate data in that objet with
out using Set?

Answer Posted / john

ArrayList al = new ArrayList();

al.add("A");
al.add("B");
al.add("A");
al.add("C');

for(int i = 0; i<al.size(); i++)
System.out.println(": " + al.get(i));

if(al.contains("A"))
al.remove("A");

for(int i = 0; i<al.size(); i++)
System.out.println("- " + al.get(i));

Is This Answer Correct ?    7 Yes 10 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is import java util arraylist?

867


How many types of assembly languages are there?

724


What is the arraylist in java?

739


What are the types of exceptions?

788


Can we have this () and super () together?

794


What is difference between static and abstract class?

742


What is the unit of plancks constant?

773


What is the use of static class?

775


Which number is denoted by leading 0x or 0x in java?

822


define polymorphism in java

843


What is the use of a copy constructor?

760


Is string is a data type in java?

799


can rmi and corba based applications interact ?

841


What is a parameter example?

720


What are the types of strings?

775