package jalview.util; import java.util.Map; public class MapUtils { /* * Return the value of the first key that exists in the map */ public static V getFirst(Map map, K... keys) { return getFirst(false, map, keys); } public static V getFirst(boolean nonNull, Map map, K... keys) { for (K key : keys) { if (map.containsKey(key)) { if (!(nonNull && (map.get(key) == null))) { return map.get(key); } else if (!nonNull) { return map.get(key); } } } return null; } public static boolean containsAKey(Map map, K... keys) { for (K key : keys) { if (map.containsKey(key)) return true; } return false; } }