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 the main purpose of java?
Why can't we make a class private in java?
what is the role of xml in core java?? and how we can use it?? can somebody give a sample program with explanation and from where i can read more about xml?????
What technique can be employed to compare two strings?
What are the differences between this and super keyword?
Is java hashset ordered?
What is ph and buffers?
What do you know about the garbage collector in java?
What is a nested list?
What is meant by inheritance and what are its advantages?
Who developed java?
What is the generic class?
Is simpledateformat safe to use in the multithreaded program?
What is a for loop in java?
What is computer compiler?