Set the group of the entity.
void add(int entity, String group) { _entitiesByGroup.putIfAbsent(group, Bag<int>.new).add(entity); _groupsByEntity.putIfAbsent(entity, Bag<String>.new).add(group); }