public static List < HollowSchema > dependencyOrderedSchemaList ( Collection < HollowSchema > schemas ) { DependencyIndex idx = new DependencyIndex ( ) ; Map < String , HollowSchema > schemaMap = new HashMap < String , HollowSchema > ( ) ; for ( HollowSchema schema : schemas ) { schemaMap . put ( schema . getName ( ) , schema ) ; idx . indexSchema ( schema , schemas ) ; } List < HollowSchema > orderedSchemas = new ArrayList < HollowSchema > ( ) ; while ( idx . hasMoreTypes ( ) ) orderedSchemas . add ( schemaMap . get ( idx . getNextType ( ) ) ) ; return orderedSchemas ; }
Dependency types come before dependent types