private Queue < PoolSchedulable > createPoolQueue ( ScheduleComparator comparator ) { int initCapacity = snapshotPools . size ( ) == 0 ? 1 : snapshotPools . size ( ) ; Queue < PoolSchedulable > poolQueue = new PriorityQueue < PoolSchedulable > ( initCapacity , comparator ) ; poolQueue . addAll ( snapshotPools ) ; return poolQueue ; }
Put all the pools into the priority queue sorted by a comparator