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 / sai



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

Is This Answer Correct ?    13 Yes 2 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is the use of singleton class?

960


How are the elements of a gridbaglayout organized in java programming?

974


What do you mean by aggregation?

1308


Which package is imported by default?

1078


What is break and continue statement?

1081


What is volatile keyword in java

1111


Why to use nested classes in java? (Or) what is the purpose of nested class in java?

1062


What is mean by exception?

1023


How to retrieve data from database in java using arraylist?

1048


Tell some latest versions in JAVA related areas?

983


What is the purpose of the main method?

981


Difference between character constant and string constant in java ?

1008


Can arraylist hold different types java?

973


When would you use a static class?

972


What is anti pattern in programming?

962