Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

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

Can you inherit a constructor java?

1031


What is a predicate method?

965


What is a module function?

1034


What is singleton class and how can we make a class singleton?

1062


What is the purpose of checked and unchecked exceptions in JAVA?

965


Why do we use string?

978


How do you clear a list in java?

1060


What does method mean?

980


What is private static class in java?

977


What is bom encoding?

959


What do you mean by Hash Map and Hash Table?

1037


What do you mean by synchronized non access modifier?

954


How is java created?

903


In a container there are 5 components. I want to display the all the components names, how will you do that one?

1003


Explain constructors and types of constructors in java.

1050