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 udp in java?
Is linkedlist thread safe in java?
What is the final keyword in java?
Name component subclasses that support painting in java programming?
What do you mean by of string::valueof expression in java 8?
Can we define static methods inside interface?
What is the difference between overriding and overloading in OOPS.
Is it possible to use string in the switch case?
What do you mean by Hash Map and Hash Table?
Can you inherit from an abstract class java?
Why are getters and setters used?
What is the purpose class.forname method?
Write a program to print the pattern given below
What is the use of conditional statement?
What are the basics of core java?