From: James Procter Date: Thu, 21 Sep 2023 16:25:48 +0000 (+0100) Subject: JAL-1551 javadoc for mapUtils X-Git-Tag: Release_2_11_3_0~8^2~2 X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=ae73ba1b149dce528d3cba7fd9a4d20b7e50baa6;p=jalview.git JAL-1551 javadoc for mapUtils --- 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)