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
Differentiate storage classes on the basis of their scope?
Define jit compiler?
What is JFC?
How does sublist works in java?
What is the purpose of file class?
What is the numeric promotion?
What is ternary operator? Give an example.
What are the difference between composition and inheritance in java?
Does collectionutils isempty check for null?
how are methods defined?
What is unicode in java?
What class allows you to read objects directly from a stream?
What is the meaning of 3 dots in java?
Why runnable interface is used in java?
What is an object class?