((float) buckets[right].usedCount) / buckets[right].itemCount); }).maximumSize(bucketCount).create();
MinMaxPriorityQueue.orderedBy(rpComparator).create(); regionsToReturn = new ArrayList<>();
/** * Builds a new min-max priority queue using the previously specified * options, and having no initial contents. */ public <T extends B> MinMaxPriorityQueue<T> create() { return create(Collections.<T>emptySet()); }
/** * Creates a new min-max priority queue using natural order, no maximum size, * and initially containing the given elements. */ public static <E extends Comparable<E>> MinMaxPriorityQueue<E> create( Iterable<? extends E> initialContents) { return new Builder<E>(Ordering.<E>natural()).create(initialContents); }
/** * Creates a new min-max priority queue with default settings: natural order, * no maximum size, no initial contents, and an initial expected size of 11. */ public static <E extends Comparable<E>> MinMaxPriorityQueue<E> create() { return new Builder<Comparable>(Ordering.natural()).create(); }
/** * @param maxSize the target size of elements in the queue * @param blockSize expected average size of blocks */ public CachedEntryQueue(long maxSize, long blockSize) { int initialSize = (int) (maxSize / blockSize); if (initialSize == 0) { initialSize++; } queue = MinMaxPriorityQueue.orderedBy(new Comparator<Map.Entry<BlockCacheKey, BucketEntry>>() { @Override public int compare(Entry<BlockCacheKey, BucketEntry> entry1, Entry<BlockCacheKey, BucketEntry> entry2) { return BucketEntry.COMPARATOR.compare(entry1.getValue(), entry2.getValue()); } }).expectedSize(initialSize).create(); cacheSize = 0; this.maxSize = maxSize; }
/** * @param maxSize the target size of elements in the queue * @param blockSize expected average size of blocks */ public LruCachedBlockQueue(long maxSize, long blockSize) { int initialSize = (int)(maxSize / blockSize); if(initialSize == 0) initialSize++; queue = MinMaxPriorityQueue.expectedSize(initialSize).create(); heapSize = 0; this.maxSize = maxSize; }