Suggest a feature
×

Welcome to TagMyCode

Please login or create account to add a snippet.
0
0
 
0
Language: Java
Posted by: Ioannis Angelis
Added: Sep 14, 2021 5:28 PM
Views: 159
Tags: java key map
  1. private Object getKeyFromValue(Map hm, Object value) {
  2.     for (Object o : hm.keySet()) {
  3.         if (hm.get(o).equals(value)) {
  4.             return o;
  5.         }
  6.     }
  7.     return null;
  8. }