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...

there are some duplicate values in ArrayList, how U'll get
that array with out duplicate?

Answer Posted / phani raju

ArrayList list = new ArrayList();
list.add("a");
list.add("b");
list.add("a");
list.add("c");
list.add("b");
LinkedHashSet lset = new LinkedHashSet
(list);
list.clear();
list.addAll(lset);
System.out.println("ArrayList : ");
for (Object data : list) {
System.out.println(data);

Is This Answer Correct ?    5 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Why scanner is used in java?

1026


What is quick sort in java?

957


Why constructor has no return type?

1056


What is a Hash Table? What are the advantages of using a hash table?

1043


What data type is true or false?

1000


What is string length in java?

904


What is jit and its use?

953


Can a static member function access member variable of an object?

968


Does importing a package imports its sub-packages as well in java?

935


What is polymorphism java example?

953


Can we access instance variables within static methods ?

1051


How strings are created in java?

984


why are wait(), notify() and notifyall() methods defined in the object class? : Java thread

946


What is a finally block? Is there a case when finally will not execute?

1011


What are invisible components?.

2095