private static TreeMap < Integer , Vector < Schedulable > > generatePriorityGroupedSchedulables ( final Collection < ? extends Schedulable > schedulables ) { TreeMap < Integer , Vector < Schedulable > > prioritizedSchedulableMap = new TreeMap < Integer , Vector < Schedulable > > ( ) ; for ( Schedulable schedulable : schedulables ) { if ( ! prioritizedSchedulableMap . containsKey ( schedulable . getPriority ( ) ) ) { prioritizedSchedulableMap . put ( schedulable . getPriority ( ) , new Vector < Schedulable > ( ) ) ; } prioritizedSchedulableMap . get ( schedulable . getPriority ( ) ) . add ( schedulable ) ; } return prioritizedSchedulableMap ; }
Group a collection of schedulables into priority groups sorted by priority .