X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Futil%2FMapUtils.java;h=3cc12446a3525e73aaf2a3880c9020bdf5e7e939;hb=c1f3a352a553ccd40063b14336b27e5a2a7329cf;hp=e0d9c0bc78470620cbfeb72f6b5903fca32bd2f0;hpb=01f8ff469a507604ed961418f7c80f9b245e60ca;p=jalview.git
diff --git a/src/jalview/util/MapUtils.java b/src/jalview/util/MapUtils.java
index e0d9c0b..3cc1244 100644
--- a/src/jalview/util/MapUtils.java
+++ b/src/jalview/util/MapUtils.java
@@ -1,17 +1,42 @@
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer ($$Version-Rel$$)
+ * Copyright (C) $$Year-Rel$$ The Jalview Authors
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see .
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+ */
package jalview.util;
import java.util.Map;
public class MapUtils
{
- /*
- * Return the value of the first key that exists in the map
+ /**
+ * Return the value of the first key that exists in the map and has a non-null
+ * value
*/
public static V getFirst(Map map, K... keys)
{
return getFirst(false, map, keys);
}
+ /**
+ * Return the value of the first key that exists in the map - optionally
+ * limiting to only returning non-null values for first extant key encountered
+ */
public static V getFirst(boolean nonNull, Map map, K... keys)
{
for (K key : keys)
@@ -31,6 +56,15 @@ public class MapUtils
return null;
}
+ /**
+ * peeks in to the map and returns true if one of a bunch of keys is contained
+ * in it
+ *
+ * @param
+ * @param map
+ * @param keys
+ * @return
+ */
public static boolean containsAKey(Map map, K... keys)
{
for (K key : keys)