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 do you mean by ternary operator in java?
What is mnemonic in assembly language?
Explain garbage collection in java?
What is thread pool? How can we create thread pool in java?
What is a ?
What are the classes of java?
Explain the difference between an Interface and an Abstract class?
What are encapsulation, inheritance and polymorphism?
What is the difference between compiler and jvm?
What is meant by inheritance and what are its advantages?
Why null value is used in string?
What is java and why do we need it? Explain
What are pass by reference and pass by value?
What are the four pillars of java?
Give us the name of the list layoutmanagers in java?