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

Describe the Big-O Notation.

1040


String class is defined under which package in java?

1074


What class allows you to read objects directly from a stream?

1318


Can we create a constructor in abstract class?

975


In the below example, how many string objects are created?

1045


What are java threads?

1123


Explain about data types?

1077


Why static functions are used?

1093


What exceptions occur during serialization?

1082


What do you mean by access modifier?

1021


What if the main() method is declared as private? What happens when the static modifier is removed from the signature of the main() method?

1181


How do I convert a numeric ip address like 192.18.97.39 into a hostname like java.sun.com?

1006


What is a marker interface?

1152


Is static a singleton?

967


What are the advantages of java over cpp?

1069