package com.lbry.database.util; import java.util.Arrays; import java.util.Map; public class MapHelper{ public static byte[] getKey(Map map,byte[] key){ for(Map.Entry entry : map.entrySet()){ if(Arrays.equals(entry.getKey(),key)){ return entry.getKey(); } } return null; } public static V getValue(Map map,byte[] key){ byte[] savedKey = MapHelper.getKey(map,key); if(savedKey!=null){ return map.get(savedKey); } return null; } public static V remove(Map map,byte[] key){ byte[] savedKey = MapHelper.getKey(map,key); if(savedKey!=null){ return map.remove(savedKey); } return null; } }