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 does java se mean?
How infinite loop is declared?
What is native code?
What is the difference between char and char *?
What is core java used for?
Write code of any action class?
Explain about OOPS concepts and fundamentals.
Can you start a thread twice in Java?
is there a separate stack for each thread in java? : Java thread
What is tree in java?
What do you understand by the term wrapper classes?
What is the tradeoff between using an unordered array versus an ordered array?
What is array command?
What do heavy weight components mean in java programming?
What is a boolean structure?