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

solution without taking time complexity into account

List arr = new ArrayList();
for(int i=0;i<count;i++){
for(int j=i+1;j<count;j++){
if(arr.get(i)!=null && arr.get(i).equals(arr.get(j))){
arr.set(j, null);
}

}
}

while(arr.contains(null))
arr.remove(null);

Is This Answer Correct ?    2 Yes 5 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Does java linked list allow duplicates?

967


How big is a gigabyte?

1026


Why string is not a wrapper class?

1174


How many bits is a boolean?

1073


When is the finally clause of a try-catch-finally statement executed?

1058


What is main in java?

1136


What are the difference between string, string builder, and string buffer in java?

1118


What is the purpose of a volatile variable?

1027


How do you call a reference in java?

971


How do you classify Dialog Box?

1107


What is main difference between variable and constant?

1025


Can we make constructors static?

1223


How do you check if a character in a string is a digit or letter?

1063


How can I become a good programmer?

974


What is the use of coding?

961