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 |
What is hashtable and explain features of hashtable?
Define immutable object?
Explain different types of thread priorities ?
What is the meaning of immutable regarding string?
Can we clone singleton class in java?
How to perform quicksort in java?
Does importing a package imports its sub-packages as well in java?
What is the use of http-tunneling in rmi?
Explain different ways of passing arguments to sub-routine?
how to print the below in java? * * * * * * * * *
List some features of the abstract class.
Which java version is latest?