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

Hey sorry. There is a small correction to the above code

/**
Remove duplicates from ArrayList<String> without using Set
*/
private static void removeDuplicates (ArrayList<String> al) {
for (int i=0;i <al.size(); i++) {
int index = al.lastIndexOf(al.get(i));
while (index != -1 && index != i) {
al.remove(i);
index = al.lastIndexOf(al.get(i));
}
}
}

Is This Answer Correct ?    2 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What super () does in java?

910


What is the difference between menuitem and checkboxmenu item?

1340


What is a bufferedreader?

1095


What are the classes of java?

968


What is an object in java and how is it created?

1057


What is hashing principle in java?

1026


What is palindrome in java?

994


How does compareto work in java?

1039


Can we catch more than one exception in a single catch block?

1080


Can a vector contain heterogenous objects?

1076


Which package is used for pattern matching with regular expressions?

1115


what is nested class in java?

1175


How do you find the maximum number from an array without comparing and sorting?

1123


What is purpose of applet programming?

1188


What is java objectoutputstream?

989