there are some duplicate values in ArrayList, how U'll get
that array with out duplicate?
Answer Posted / sai
ArrayList list = new ArrayList();
list.add("a");
list.add("b");
list.add("a");
list.add("c");
list.add("b");
HashSet set = new HashSet(list);
list.clear();
list.addAll(set);
System.out.println("ArrayList : ");
for (Object data : list) {
System.out.println(data);
Is This Answer Correct ? | 13 Yes | 2 No |
Post New Answer View All Answers
What is ascii format?
Can we make a constructor final?
What is the final access modifier in java?
What is the type of lambda expression?
Discuss different types of errors that generally occur while programming.
What are the 3 types of control structures?
What is the purpose of using java.lang.class class?
Can a class be private in java?
What is a nested class?
How does hashmap work in java ?
Why hashcode is used in java?
Why string is a class?
What is replaceall in java?
What is the maximum size of byte array in java?
What is the use of default method in interface in java?