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
Describe the Big-O Notation.
String class is defined under which package in java?
What class allows you to read objects directly from a stream?
Can we create a constructor in abstract class?
In the below example, how many string objects are created?
What are java threads?
Explain about data types?
Why static functions are used?
What exceptions occur during serialization?
What do you mean by access modifier?
What if the main() method is declared as private? What happens when the static modifier is removed from the signature of the main() method?
How do I convert a numeric ip address like 192.18.97.39 into a hostname like java.sun.com?
What is a marker interface?
Is static a singleton?
What are the advantages of java over cpp?