there are some duplicate values in ArrayList, how U'll get
that array with out duplicate?
Answer Posted / sai
ArrayList list = new ArrayList();
list.add("a");
list.add("b");
list.add("a");
list.add("c");
list.add("b");
HashSet set = new HashSet(list);
list.clear();
list.addAll(set);
System.out.println("ArrayList : ");
for (Object data : list) {
System.out.println(data);
| Is This Answer Correct ? | 13 Yes | 2 No |
Post New Answer View All Answers
Is java a compiler?
Can a class be protected in java?
Java openings 3 - 5 years, Lnt Infotech. requirements - core java, J2ee, struts, hibernate Interview Date:- 19 March 2011 Time:- 9:00 AM to 12:00 Pm Interview Location - L & T Infotech, Manapakkam, Chennai Refererral PS NO:- 291649 (Please mention this when u fill the form only then u will be considered for interview) Documents Required:- Latest Resume, Photograph and last 3 payslips Mail me on vasan2211@gmail.com once u appear for interview
What is the length of a string?
Difference between java and javascript
Give me example of derived data types.
What will be the output of round(3.7) and ceil(3.7)?
who can i handle multiple client in RMI
What is a vararg?
What is methodological framework?
Are functions objects in java?
Does chrome use java?
What is the difference between array and array list in java?
Can you access non static variable in static context?
What is instance means in java?