TagGroupUtils { public static boolean containsAll(@NonNull Map<String, Set<String>> lh, @NonNull Map<String, Set<String>> rh) { for (Map.Entry<String, Set<String>> entry : rh.entrySet()) { Set<String> tags = lh.get(entry.getKey()); if (tags == null || !tags.containsAll(entry.getValue())) { return false; } } return true; }  @NonNull static Map<String, Set<String>> union(@NonNull Map<String, Set<String>> lh, @NonNull Map<String, Set<String>> rh); static void addAll(@NonNull Map<String, Set<String>> lh, @NonNull Map<String, Set<String>> rh); static boolean containsAll(@NonNull Map<String, Set<String>> lh, @NonNull Map<String, Set<String>> rh); @NonNull static Map<String, Set<String>> intersect(@NonNull Map<String, Set<String>> lh, @NonNull Map<String, Set<String>> rh); @NonNull static Map<String, Set<String>> parseTags(@Nullable JsonValue value);  }
@Test public void testContainsAll() { Map<String, Set<String>> fullSet = new HashMap<>(); fullSet.put("shared-group", tagSet("cool", "story")); fullSet.put("unique-group", tagSet("cool", "story")); Map<String, Set<String>> subSet = new HashMap<>(); subSet.put("shared-group", tagSet("cool")); assertTrue(TagGroupUtils.containsAll(fullSet, subSet)); assertFalse(TagGroupUtils.containsAll(subSet, fullSet)); }