git://source.jalview.org
/
jalview.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Merge branch 'develop' into improvement/JAL-4124_dont_duplacate_PAE_data_acrossviews
[jalview.git]
/
src
/
jalview
/
util
/
MapUtils.java
diff --git
a/src/jalview/util/MapUtils.java
b/src/jalview/util/MapUtils.java
index
e0d9c0b
..
6ab053a
100644
(file)
--- a/
src/jalview/util/MapUtils.java
+++ b/
src/jalview/util/MapUtils.java
@@
-4,14
+4,19
@@
import java.util.Map;
public class MapUtils
{
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 <K, V> V getFirst(Map<K, V> map, K... keys)
{
return getFirst(false, map, keys);
}
*/
public static <K, V> V getFirst(Map<K, V> 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 <K, V> V getFirst(boolean nonNull, Map<K, V> map, K... keys)
{
for (K key : keys)
public static <K, V> V getFirst(boolean nonNull, Map<K, V> map, K... keys)
{
for (K key : keys)
@@
-31,6
+36,15
@@
public class MapUtils
return null;
}
return null;
}
+ /**
+ * peeks in to the map and returns true if one of a bunch of keys is contained
+ * in it
+ *
+ * @param <K>
+ * @param map
+ * @param keys
+ * @return
+ */
public static <K> boolean containsAKey(Map<K, ?> map, K... keys)
{
for (K key : keys)
public static <K> boolean containsAKey(Map<K, ?> map, K... keys)
{
for (K key : keys)