Delete comment from: Javarevisited
satish said...
int arr[] = { 2, 4, 5, 8, 5, 6, 5, 9, 3, 3, 3 };
Map map = new HashMap();
for (int i : arr) {
Integer count = map.get(i);
map.put(i, count != null ? count + 1 : 0);
}
for (Map.Entry data : map.entrySet()) {
System.out.println("data : " + data.getKey() + " ,occurance :"
+ data.getValue());
}
Nov 18, 2013, 11:17:37 AM
Posted to How to get Key From Value in Hashtable, HashMap in Java? Example