@Override public void mergeAccumulator(BoundedHeap<T, ComparatorT> accumulator) { for (T value : accumulator.asList()) { if (!maybeAddInput(value)) { // If this element of accumulator does not make the top N, neither // will the rest, which are all smaller. break; } } }
@Override public void registerByteSizeObserver( BoundedHeap<T, ComparatorT> value, ElementByteSizeObserver observer, Context context) throws Exception { listCoder.registerByteSizeObserver(value.asList(), observer, context); }
@Override public boolean isRegisterByteSizeObserverCheap( BoundedHeap<T, ComparatorT> value, Context context) { return listCoder.isRegisterByteSizeObserverCheap(value.asList(), context); }
@Override public void encode(BoundedHeap<T, ComparatorT> value, OutputStream outStream, Context context) throws CoderException, IOException { listCoder.encode(value.asList(), outStream, context); }