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 the use of singleton class?
How are the elements of a gridbaglayout organized in java programming?
What do you mean by aggregation?
Which package is imported by default?
What is break and continue statement?
What is volatile keyword in java
Why to use nested classes in java? (Or) what is the purpose of nested class in java?
What is mean by exception?
How to retrieve data from database in java using arraylist?
Tell some latest versions in JAVA related areas?
What is the purpose of the main method?
Difference between character constant and string constant in java ?
Can arraylist hold different types java?
When would you use a static class?
What is anti pattern in programming?