public static <T extends HierarchicalType>List<T> sortTypes(List<T> types){
  Map<String,T> typesByName=new HashMap<>();
  for (  T type : types) {
    typesByName.put(type.name,type);
  }
  List<T> result=new ArrayList<>(types.size());
  Set<T> processed=new HashSet<>();
  for (  T type : types) {
    addToResult(type,result,processed,typesByName);
  }
  return result;
}

public static < T extends HierarchicalType > List < T > sortTypes ( List < T > types ) { Map < String , T > typesByName = new HashMap < > ( ) ; for ( T type : types ) { typesByName . put ( type . name , type ) ; } List < T > result = new ArrayList < > ( types . size ( ) ) ; Set < T > processed = new HashSet < > ( ) ; for ( T type : types ) { addToResult ( type , result , processed , typesByName ) ; } return result ; }
sorts the specified hierarchical types by supertype dependencies , such that any type a which is a supertype of type b will always be located earlier in the result list ; that is , the supertype a would be found at some index i and subtype b would be found at some index j , and i < j .
