Lines Matching defs:elements

66    * Creates an {@code ArrayDeque} containing the elements of the specified iterable,
71 public static <E> ArrayDeque<E> newArrayDeque(Iterable<? extends E> elements) {
72 if (elements instanceof Collection) {
73 return new ArrayDeque<E>(Collections2.cast(elements));
76 Iterables.addAll(deque, elements);
90 * Creates a {@code ConcurrentLinkedQueue} containing the elements of the specified iterable,
94 Iterable<? extends E> elements) {
95 if (elements instanceof Collection) {
96 return new ConcurrentLinkedQueue<E>(Collections2.cast(elements));
99 Iterables.addAll(queue, elements);
126 * containing the elements of the specified iterable,
131 public static <E> LinkedBlockingDeque<E> newLinkedBlockingDeque(Iterable<? extends E> elements) {
132 if (elements instanceof Collection) {
133 return new LinkedBlockingDeque<E>(Collections2.cast(elements));
136 Iterables.addAll(deque, elements);
160 * containing the elements of the specified iterable,
163 * @param elements the elements that the queue should contain, in order
164 * @return a new {@code LinkedBlockingQueue} containing those elements
166 public static <E> LinkedBlockingQueue<E> newLinkedBlockingQueue(Iterable<? extends E> elements) {
167 if (elements instanceof Collection) {
168 return new LinkedBlockingQueue<E>(Collections2.cast(elements));
171 Iterables.addAll(queue, elements);
181 * elements' natural ordering.
190 * Creates a {@code PriorityBlockingQueue} containing the given elements.
198 Iterable<? extends E> elements) {
199 if (elements instanceof Collection) {
200 return new PriorityBlockingQueue<E>(Collections2.cast(elements));
203 Iterables.addAll(queue, elements);
211 * elements' natural ordering.
220 * Creates a {@code PriorityQueue} containing the given elements.
228 Iterable<? extends E> elements) {
229 if (elements instanceof Collection) {
230 return new PriorityQueue<E>(Collections2.cast(elements));
233 Iterables.addAll(queue, elements);
248 * {@code numElements} elements are not available, it will wait for them up to the specified
252 * @param buffer where to add the transferred elements
253 * @param numElements the number of elements to be waited for
256 * @return the number of elements transferred
272 // elements already available (e.g. LinkedBlockingQueue#drainTo locks only once)
274 if (added < numElements) { // not enough elements immediately available; will have to poll
277 break; // we already waited enough, and there are no more elements in sight
293 * @param buffer where to add the transferred elements
294 * @param numElements the number of elements to be waited for
297 * @return the number of elements transferred
309 // multiple elements already available (e.g. LinkedBlockingQueue#drainTo locks only once)
311 if (added < numElements) { // not enough elements immediately available; will have to poll
322 break; // we already waited enough, and there are no more elements in sight