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 byte code and why is it important to java’s use for internet programming?
Explain the significance of class loaders in bootstrap?
What is a variable and constant?
How is it possible for two string objects with identical values not to be equal under the == operator?
Is 0 an irrational number?
What is sortedmap interface?
Why is method overloading not possible by changing the return type in java?
What is the significance of listiterator?
How many unicode characters are there?
Justify your answer that you can't define a method inside another method in java, if you can then how?
how to split string in java?
Why can't we use static class instead of singleton?
What is the use of flag?
Is ruby built on java?
What is another word for methodology?