code: public static HashMap<Group, Category> mapGroupsToCategories(List<Category> categories) {
      HashMap<Group, Category> groupCategoryMap = new HashMap<>();
      for (Category category : categories) {
        if (category.getGroups() != null) {
          for (Group group : category.getGroups()) {
            groupCategoryMap.put(group, category);
          }
        }
      }
      return groupCategoryMap;
    }
docs: Creates a map which links {@link Group} to {@link Category} in a list of {@code categories}.
  
  @param categories the categories of which to create a map of
  @return a {@link HashMap} containing {@link Group}, mapped to their
  corresponding {@link Category}
  @apiNote does not flatten the categories