X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Futil%2FMapUtils.java;fp=src%2Fjalview%2Futil%2FMapUtils.java;h=6ab053a6087402d6750c9b4f794b448ec2305bc2;hb=b122ba188c2ffcbb302809bafc02058e355643ee;hp=e0d9c0bc78470620cbfeb72f6b5903fca32bd2f0;hpb=e91b3bef83f320e13c59ad5d21d69f0abf3d7507;p=jalview.git diff --git a/src/jalview/util/MapUtils.java b/src/jalview/util/MapUtils.java index e0d9c0b..6ab053a 100644 --- a/src/jalview/util/MapUtils.java +++ b/src/jalview/util/MapUtils.java @@ -4,14 +4,19 @@ 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 +36,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)