private Queue < PoolGroupSchedulable > createPoolGroupQueue ( ScheduleComparator comparator ) { int initCapacity = snapshotPoolGroups . size ( ) == 0 ? 1 : snapshotPoolGroups . size ( ) ; Queue < PoolGroupSchedulable > poolGroupQueue = new PriorityQueue < PoolGroupSchedulable > ( initCapacity , comparator ) ; poolGroupQueue . addAll ( snapshotPoolGroups ) ; return poolGroupQueue ; }
Put all the pool groups into the priority queue sorted by a comparator