I\'m creating an educational game for young students who needs to learn the most common words. On random I pick three words of the list, show them on the screen, play an audio r
Possibly the shortest solution, with Java 8:
private String getMinKey(Map map, String... keys) { return map.entrySet().stream() .filter(p -> Arrays.asList(keys).contains(p.getKey())) .min(Comparator.comparingInt(Map.Entry::getValue)).get().getKey(); }