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 / john
ArrayList al = new ArrayList();
al.add("A");
al.add("B");
al.add("A");
al.add("C');
for(int i = 0; i<al.size(); i++)
System.out.println(": " + al.get(i));
if(al.contains("A"))
al.remove("A");
for(int i = 0; i<al.size(); i++)
System.out.println("- " + al.get(i));
| Is This Answer Correct ? | 7 Yes | 10 No |
Post New Answer View All Answers
Can you inherit a constructor java?
What is a predicate method?
What is a module function?
What is singleton class and how can we make a class singleton?
What is the purpose of checked and unchecked exceptions in JAVA?
Why do we use string?
How do you clear a list in java?
What does method mean?
What is private static class in java?
What is bom encoding?
What do you mean by Hash Map and Hash Table?
What do you mean by synchronized non access modifier?
How is java created?
In a container there are 5 components. I want to display the all the components names, how will you do that one?
Explain constructors and types of constructors in java.