Java tutorial
//package com.java2s; import java.util.HashSet; import java.util.Map; import java.util.Set; import java.util.Map.Entry; public class Main { /** * Many to One way of finding Keys from value * @param map * @param value * @return keys */ public static <T, E> Set<T> getKeysByValue(Map<T, E> map, E value) { Set<T> keys = new HashSet<T>(); for (Entry<T, E> entry : map.entrySet()) { if (value.equals(entry.getValue())) { keys.add(entry.getKey()); } } return keys; } }