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


Please Help Members By Posting Answers For Below Questions

What is byte code and why is it important to java’s use for internet programming?

590


Explain the significance of class loaders in bootstrap?

492


What is a variable and constant?

543


How is it possible for two string objects with identical values not to be equal under the == operator?

521


Is 0 an irrational number?

594






What is sortedmap interface?

546


Why is method overloading not possible by changing the return type in java?

583


What is the significance of listiterator?

563


How many unicode characters are there?

548


Justify your answer that you can't define a method inside another method in java, if you can then how?

600


how to split string in java?

645


Why can't we use static class instead of singleton?

496


What is the use of flag?

577


Is ruby built on java?

527


What is another word for methodology?

514