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

Difference between Linked list and Queue?

613


Is cout buffered?

688


What is the basic of java?

573


Which software is used for java programming?

561


How do you break a loop?

566






What does ide stand for?

523


How to sort list of list in java?

663


What is size_t?

507


What is an example of procedure?

516


Can we override the private methods?

528


what are Hostile Applets?

1608


What is illegal identifier in java?

538


Explain why wait(), notify() and notifyall() methods are in object class rather than in thread class?

563


What is jit and its use?

587


Write a java program to print fibonacci series?

542