Group { public void addToGroup(K groupKey, T object) { Array<T> list = getGroup(groupKey); if (!list.contains(object, false)) { list.add(object); all.add(object); sourceToKeyMap.put(object, groupKey); } else { Gdx.app.error("GROUP", "Unable to add " + object + " to group " + groupKey + ": already exists!"); } }  void addToGroup(K groupKey, T object); Array<T> getAll(); Array<K> getGroupKeys(); void remove(T object); void removeFromGroup(K groupKey, T object); Array<T> getGroup(K groupKey); void clearGroup(K groupKey); void clear();  }
@Test public void addToGroup() { Group<String, String> group = new Group<String, String>(); group.addToGroup("a", "b"); assertThat(group.getGroup("a")).containsExactly("b"); }