public < T extends Named > List < T > prepareProcessors ( List < T > namedList , String type ) { List < T > ret = new ArrayList <> ( ) ; Map < String , T > lookup = new HashMap <> ( ) ; for ( T named : namedList ) { lookup . put ( named . getName ( ) , named ) ; } for ( String inc : includes ) { if ( use ( inc ) ) { T named = lookup . get ( inc ) ; if ( named == null ) { List < String > keys = new ArrayList <> ( lookup . keySet ( ) ) ; Collections . sort ( keys ) ; throw new IllegalArgumentException ( "No " + type + " with name '" + inc + "' found to include. " + "Please check spelling in your profile / config and your project dependencies. Included " + type + "s: " + StringUtils . join ( keys , ", " ) ) ; } ret . add ( named ) ; } } return ret ; }
Order elements according to the order provided by the include statements . If no includes has been configured return the given list unaltered . Otherwise arrange the elements from the list in to the include order and return a new list .