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
Why array is used in java?
what is thread in Java ?
Is a class subclass of itself?
What is parsing and its types?
How to read and write image from a file ?
Where are global variables stored?
please send me hr interview questions in it industry
What is the difference between jfc & wfc?
If an object is garbage collected, can it become reachable again?
Can we create an object if a class doesn't have any constructor ( not even the default provided by constructor ) ?
how are methods defined?
What is * argv?
Why java is not 100% object-oriented?
How many days will it take to learn java?
how to prepare for IT Officers Interview in Banks