indexed.iterator(), NullHandling::nullToEmptyIfNeeded
DictionaryMergeIterator(Indexed<String>[] dimValueLookups, boolean useDirect) { pQueue = new PriorityQueue<>(dimValueLookups.length, NULLS_FIRST_PEEKING_COMPARATOR); conversions = new IntBuffer[dimValueLookups.length]; for (int i = 0; i < conversions.length; i++) { if (dimValueLookups[i] == null) { continue; } Indexed<String> indexed = dimValueLookups[i]; if (useDirect) { int allocationSize = indexed.size() * Integer.BYTES; log.info("Allocating dictionary merging direct buffer with size[%,d]", allocationSize); final ByteBuffer conversionDirectBuffer = ByteBuffer.allocateDirect(allocationSize); conversions[i] = conversionDirectBuffer.asIntBuffer(); directBufferAllocations.add(new Pair<>(conversionDirectBuffer, allocationSize)); } else { conversions[i] = IntBuffer.allocate(indexed.size()); } final PeekingIterator<String> iter = Iterators.peekingIterator( Iterators.transform( indexed.iterator(), NullHandling::nullToEmptyIfNeeded ) ); if (iter.hasNext()) { pQueue.add(Pair.of(i, iter)); } } }