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

Is minecraft 1.15 out?

922


What is externalizable?

1011


What are the methods to rectify ambiguities in the interfaces in JAVA?

1028


Is Constructor possible in abstract class in java ?

985


Can a constructor call the constructor of parent class?

974


What are the three parts of a lambda expression? What is the type of lambda expression?

978


Can you extend main method in java?

1094


Explain the difference between an Interface and an Abstract class?

1113


How does linkedlist work in java?

872


How many bytes is a char in java?

970


What is structure of java heap? What is perm gen space in heap?

1049


How do you decide when to use arraylist and linkedlist?

942


What are exceptions

1035


What is a databasemetadata?

899


What are the restrictions imposed by a Security Manager on Applets?.

2557