/** * Creates a new queue that contains the given elements. * * @param initialElements The elements to initially add to the queue. */ public ClosableBlockingQueue(Collection<? extends E> initialElements) { this(initialElements.size()); this.elements.addAll(initialElements); }
/** * Copy all pending entries in this queue into the destination queue. * @param dest to copy pending buffers to. */ public final void copyTo(AbstractCoalescingBufferQueue dest) { dest.bufAndListenerPairs.addAll(bufAndListenerPairs); dest.incrementReadableBytes(readableBytes); }
/** * Copy all pending entries in this queue into the destination queue. * @param dest to copy pending buffers to. */ public final void copyTo(AbstractCoalescingBufferQueue dest) { dest.bufAndListenerPairs.addAll(bufAndListenerPairs); dest.incrementReadableBytes(readableBytes); }
/** * Copy all pending entries in this queue into the destination queue. * @param dest to copy pending buffers to. */ public final void copyTo(AbstractCoalescingBufferQueue dest) { dest.bufAndListenerPairs.addAll(bufAndListenerPairs); dest.incrementReadableBytes(readableBytes); }
/** * Constructs a deque containing the elements of the specified * collection, in the order they are returned by the collection's * iterator. (The first element returned by the collection's * iterator becomes the first element, or <i>front</i> of the * deque.) * * @param c the collection whose elements are to be placed into the deque * @throws NullPointerException if the specified collection is null */ public ArrayDeque(Collection<? extends E> c) { allocateElements(c.size()); addAll(c); }
private void rewriteToBlockSize(int targetBlockBits) { assert targetBlockBits <= maxBitsPerBlock; // We copy over data blocks to an output with one-larger block bit size. // We also discard references to blocks as we're copying to allow GC to // clean up partial results in case of memory pressure. ByteBuffersDataOutput cloned = new ByteBuffersDataOutput(targetBlockBits, targetBlockBits, blockAllocate, NO_REUSE); ByteBuffer block; while ((block = blocks.pollFirst()) != null) { block.flip(); cloned.writeBytes(block); if (blockReuse != NO_REUSE) { blockReuse.accept(block); } } assert blocks.isEmpty(); this.blockBits = targetBlockBits; blocks.addAll(cloned.blocks); }
@SafeVarargs private MockFetcher(HashMap<KafkaTopicPartition, Long>... stateSnapshotsToReturn) throws Exception { super( new TestSourceContext<>(), new HashMap<>(), null, null, new TestProcessingTimeService(), 0, MockFetcher.class.getClassLoader(), new UnregisteredMetricsGroup(), false); this.stateSnapshotsToReturn.addAll(Arrays.asList(stateSnapshotsToReturn)); }
@Override public ObjectStatus[] getObjectStatuses() { ArrayDeque<DirectoryOrObject> objects = new ArrayDeque<>(); Container container = mAccount.getContainer(mContainerName); if (!mRecursive) { objects.addAll(container.listDirectory(mPaginationMap.getPrefix(), PATH_SEPARATOR_CHAR, mPaginationMap.getMarker(mPage), mPaginationMap.getPageSize())); } else { objects.addAll(container.list(mPaginationMap, mPage)); } int i = 0; ObjectStatus[] res = new ObjectStatus[objects.size()]; for (DirectoryOrObject object : objects) { if (object.isObject()) { res[i++] = new ObjectStatus(object.getName(), object.getAsObject().getEtag(), object.getAsObject().getContentLength(), object.getAsObject().getLastModifiedAsDate().getTime()); } else { res[i++] = new ObjectStatus(object.getName()); } } return res; }
nodesToProcess.addAll(leafNodes);
/** * Add all of the tables, in the specified order. * <p> * Unconditionally adds all tables, ignoring the * {@link #setCompactBytesLimit(long)}. * * @param readers * tables to compact. Tables should be ordered oldest first/most * recent last so that the more recent tables can shadow the * older results. Caller is responsible for closing the readers. * @throws java.io.IOException * update indexes of a reader cannot be accessed. */ public void addAll(List<? extends Reftable> readers) throws IOException { tables.addAll(readers); for (Reftable r : readers) { if (r instanceof ReftableReader) { adjustUpdateIndexes((ReftableReader) r); } } }
/** * Dereference the "iterator" * * @return CtElement the next element in DFS order without going down the tree */ @Override public CtElement next() { CtElement next = deque.pollFirst(); // get the element to expand from the deque current_children.clear(); // clear for this scan next.accept(this); // call @scan for each direct child of the node deque.addAll(current_children); // overridden method to add all to first return next; } }
/** * Convenience for {@code inbox.queue().addAll(collection)} */ public void addAll(Collection<?> collection) { queue.addAll(collection); }
/** * Creates a new queue that contains the given elements. * * @param initialElements The elements to initially add to the queue. */ public ClosableBlockingQueue(Collection<? extends E> initialElements) { this(initialElements.size()); this.elements.addAll(initialElements); }
public static void checkedPayloadAddAll(ArrayDeque<EventBean> events, Object value) { if (value instanceof EventBean) { events.add((EventBean) value); return; } ArrayDeque<EventBean> q = (ArrayDeque<EventBean>) value; events.addAll(q); }
/** * Copy all pending entries in this queue into the destination queue. * @param dest to copy pending buffers to. */ public final void copyTo(AbstractCoalescingBufferQueue dest) { dest.bufAndListenerPairs.addAll(bufAndListenerPairs); dest.incrementReadableBytes(readableBytes); }
/** * Copy all pending entries in this queue into the destination queue. * @param dest to copy pending buffers to. */ public final void copyTo(AbstractCoalescingBufferQueue dest) { dest.bufAndListenerPairs.addAll(bufAndListenerPairs); dest.incrementReadableBytes(readableBytes); }
/** * Copy all pending entries in this queue into the destination queue. * @param dest to copy pending buffers to. */ public final void copyTo(AbstractCoalescingBufferQueue dest) { dest.bufAndListenerPairs.addAll(bufAndListenerPairs); dest.incrementReadableBytes(readableBytes); }