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

Why array is used in java?

908


what is thread in Java ?

1097


Is a class subclass of itself?

1026


What is parsing and its types?

1024


How to read and write image from a file ?

993


Where are global variables stored?

889


please send me hr interview questions in it industry

2062


What is the difference between jfc & wfc?

1012


If an object is garbage collected, can it become reachable again?

944


Can we create an object if a class doesn't have any constructor ( not even the default provided by constructor ) ?

1024


how are methods defined?

995


What is * argv?

1162


Why java is not 100% object-oriented?

1430


How many days will it take to learn java?

882


how to prepare for IT Officers Interview in Banks

1911