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
What is an example of a conditional statement?
What are the three best choices for a development environment?
Does sprintf allocate memory?
When is the finalize() called?
What is the difference between keyword and identifier?
How many java versions are there?
What is finally in Java?
Explain access specifiers?
What's the purpose of static methods and static variables?
Can we make main() thread as daemon?
Which language is java?
What is the synchronized method modifier?
Break statement can be used as labels in java?
Write an algorithm for quick sort?
What are invisible components?.