there are some duplicate values in ArrayList, how U'll get
that array with out duplicate?
Answer Posted / shilpa
List<Integer> arlList=new ArrayList<Integer>();
arlList.add(20);
arlList.add(2);
arlList.add(1);
arlList.add(6);
arlList.add(6);
Set<Integer> tr=new TreeSet<Integer>(arlList);
Iterator<Integer> iterator=tr.iterator();
while(iterator.hasNext()){
System.out.println(iterator.next());
}
| Is This Answer Correct ? | 4 Yes | 0 No |
Post New Answer View All Answers
What is java ceil?
What is pojo class in java?
How does map works in java?
Explain the difference between runnable and callable interface in java?
What are the differences between the constructors and methods?
What is the difference between an inner class and a sub-class?
What is a module function?
What is supplier in java?
What are the advantages of inner classes?
What is nested class?
What is the size of int in 64-bit jvm?
What is a jit compiler?
What are the four integer types supported by java?
worst case complexities of Quick sort and Merge sort.
What is the primary benefit of encapsulation?