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 the constructor and how many types of constructors are used in java?
Is it necessary for the port addresses to be unique? Explain with reason.
What is string :: npos?
How many threads does a core java have?
Define immutable object?
When a byte datatype is used?
What is hashset in java?
What is object data type?
Why do we need wrapper class?
What is a war file?
What is the inheritance?
Hi friends am new to java. I read jar file means collection of java files. For executing struts application what are the necessary jar files. " struts.jar " file contains what. can u explain
What is wrapper class html?
What is the difference between JDK and JVM?
What is the type of lambda expression?