public static < T > Map < String , List < T > > groupByClusterName ( List < T > inputs , AsgNameProvider < T > nameProvider ) { Map < String , List < T > > clusterNamesToAsgs = new HashMap < String , List < T > > ( ) ; for ( T input : inputs ) { String clusterName = Names . parseName ( nameProvider . extractAsgName ( input ) ) . getCluster ( ) ; if ( ! clusterNamesToAsgs . containsKey ( clusterName ) ) { clusterNamesToAsgs . put ( clusterName , new ArrayList < T > ( ) ) ; } clusterNamesToAsgs . get ( clusterName ) . add ( input ) ; } return clusterNamesToAsgs ; }
Groups a list of ASG related objects by cluster name .