public Map<String,ResourceImpl> aggregateByType(List<ResourceImpl> resources) throws NotFoundException {
  checkSupporting(resources);
  Map<String,ResourceImpl> type2Resource=new HashMap<>();
  for (  ResourceImpl resource : resources) {
    final ResourceImpl resource1=type2Resource.get(resource.getType());
    if (resource1 != null) {
      type2Resource.put(resource.getType(),aggregate(resource1,resource));
    }
 else {
      type2Resource.put(resource.getType(),resource);
    }
  }
  return type2Resource;
}

public Map < String , ResourceImpl > aggregateByType ( List < ResourceImpl > resources ) throws NotFoundException { checkSupporting ( resources ) ; Map < String , ResourceImpl > type2Resource = new HashMap < > ( ) ; for ( ResourceImpl resource : resources ) { final ResourceImpl resource1 = type2Resource . get ( resource . getType ( ) ) ; if ( resource1 != null ) { type2Resource . put ( resource . getType ( ) , aggregate ( resource1 , resource ) ) ; } else { type2Resource . put ( resource . getType ( ) , resource ) ; } } return type2Resource ; }
aggregates resources of the same type .
