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 does replaceall do in java?
What is re-factoring in software?
Difference between start() and run() method of thread class?
What is a private class in java?
What modifiers may be used with a top-level class?
What is null in java?
Explain about the security aspect of java?
Which number is denoted by leading zero in java?
How do you create an array in java?
What is break and continue statement?
Can a class have more than one object?
What is the return type of the main method?
What is arguments in java?
Is java based on c?
How can you make sure that your singleton class will always return single instance in multi-threaded environment?