how to identify duplicate values in arraylist
Answers were Sorted based on User's Feedback
Answer / shrinu nallavelli
arrayList elements are differentiated by their index values
onlu..
| Is This Answer Correct ? | 3 Yes | 3 No |
Answer / srikanth m
List<String> list = new ArrayList<String>();
list.add("abc");
list.add("def");
list.add("abc");
HashMap<String, Integer> map = new HashMap<String, Integer>();
for (String str : list) {
Integer c = (Integer) map.get(str);
if (c == null || c == 0) {
map.put(str, 1);
} else {
map.put(str, ++c);
}
}
System.out.println(map);
| Is This Answer Correct ? | 0 Yes | 0 No |
Where is jre installed?
Which data type is a class in java?
What is a default constructor and also define copy contrucyor?
What is equals method in java?
What makes a function well defined?
describe method overloading
How static variable work in java?
What is thread?
What is the output of the following Java program? class Main { public static void main(String args[]){ final int i; i = 10; System.out.println(i); } } 10. What is the output of the following Java program? class Main { public static void main(String args[]){ final int i; i = 10; System.out.println(i); } }
write a program to create an arraylist and listeterator.and value should be enter through keyboard.
What is the difference between pageContext and page implicit objects in jsp?
9 Answers Gspann Technologies, Merrill Lynch, Polaris,
Why Java is not purely object oriented?
50 Answers Elitecore, Persistent, Reliance, Wipro,