add sizeAll to SetMap
authorAndreas Müller <a.mueller@bgbm.org>
Fri, 7 May 2021 13:32:36 +0000 (15:32 +0200)
committerAndreas Müller <a.mueller@bgbm.org>
Fri, 7 May 2021 13:43:42 +0000 (15:43 +0200)
cdmlib-commons/src/main/java/eu/etaxonomy/cdm/common/SetMap.java

index 2128734e49566686bd7b75a7abf76fabaddf2173..b130fb4da02fb5660aa4e7c458070ba97b266869 100644 (file)
@@ -15,7 +15,7 @@ import java.util.Map;
 import java.util.Set;
 
 /**
- * This class wrapps a {@link Map} with a {@link Set} as value.
+ * This class wraps a {@link Map} with a {@link Set} as value.
  * It offers convenience methods to avoid Set creation for the user.
  *
  * @author a.mueller
@@ -41,6 +41,14 @@ public class SetMap<K,V> implements Map<K, Set<V>>{
         return map.size();
     }
 
+    public int sizeAll() {
+        int result = 0;
+        for (Set<V> set : map.values()){
+            result += set.size();
+        }
+        return result;
+    }
+
     @Override
     public boolean isEmpty() {
         return map.isEmpty();