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
Are arrays primitive data types?
What are thread safe functions?
explain copyonwritearraylist and when do we use copyonwritearraylist?
What are scalar data types?
Does java support multiple inheritances?
Why can we not override static method?
Write a java program to generate fibonacci series ?
What are register variables what are the advantages?
How do you replace all in word?
What's the base class in java from which all classes are derived?
What's the purpose of static methods and static variables?
how to open and edit XML file in Weblogic???
What is a substitution variable?
What is close method? How it's different from Finalize & Dispose?
What is the access scope of a protected method?