code: public List<GROUP> getGroups(List<RESOURCE> resources) {
  
          List<RESOURCE> sortedResources = new ArrayList<RESOURCE>(resources);
          Collections.sort(sortedResources, new SortingComparator());
          Map<Long, Integer> daysMap = computeDaysForResources(sortedResources);
          Map<GroupAge, List<RESOURCE>> resourcesByAge = partitionPublishResourcesByAge(sortedResources, daysMap);
          List<List<RESOURCE>> youngGroups = partitionYoungResources(resourcesByAge.get(GroupAge.young));
          List<List<RESOURCE>> mediumGroups = partitionMediumResources(resourcesByAge.get(GroupAge.medium), daysMap);
          List<RESOURCE> oldGroup = resourcesByAge.get(GroupAge.old);
          List<GROUP> resultGroups = new ArrayList<GROUP>();
          for (List<RESOURCE> groupRes : youngGroups) {
              String name = getPublishGroupName(groupRes, GroupAge.young);
              resultGroups.add(createGroup(name, groupRes));
          }
          for (List<RESOURCE> groupRes : mediumGroups) {
              String name = getPublishGroupName(groupRes, GroupAge.medium);
              resultGroups.add(createGroup(name, groupRes));
          }
          if (!oldGroup.isEmpty()) {
              String oldName = getPublishGroupName(oldGroup, GroupAge.old);
              resultGroups.add(createGroup(oldName, oldGroup));
          }
          return resultGroups;
      }
docs: Splits a list of resources into groups.<p>
  
  @param resources the list of resources
  
  @return the list of groups