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
Is minecraft 1.15 out?
What is the difference between pass by reference and pass by pointer?
Why java is made?
Can we sort hashset in java?
What is jagged array in java?
What is the difference between and ?
What are mutable classes?
Can an integer be a string?
Write down program for following scenario. Use java coding standard. You have array list with some words in it..we will call it as dictionary….and you have a arbitrary string containing some chars in it. You have to go through each word of dictionary and find out if that word can be constructed with the help of chars from arbitrary string given. If you find the word print it else print none.
Can I learn java in 3 months?
What is the biggest integer?
What is protected in java?
What is size of int in java?
What is the difference between the font and fontmetrics classes in java programming?
How to perform selection sort in java?