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
What is a method type?
What is a boolean expression in java?
In which order the iterator iterates over collection?
What do you mean by constructor?
What is a generic type?
When will you define a method as static in Java?
What are the types of java?
What’s the difference between constructors and other methods?
Why null value is used in string?
What is java beans?
Why put method is used?
Why do we need singleton class?
What is the purpose of using break in each case of switch statement?
What is the maximum size of a string in java?
Which list is sorted in java?