Aggregates the elements from each of the given deque. It takes one
element from the head of each deque in each loop and put them into a
single list. This method modifies the deques in-place.
@param stuff
@return
510101
public static <K> List<K> zip(Collection<Deque<K>> stuff)
    {
        final List<K> result = Lists.newArrayList();

        // merge the results
        Iterator<Deque<K>> iter = stuff.iterator();
        while (iter.hasNext()) {
            final K next = iter.next().poll();
            if (next != null) {
                result.add(next);
            } else {
                iter.remove();
            }

            if (!iter.hasNext()) {
                iter = stuff.iterator();
            }
        }

        return result;
    }
1370643
public static List<ItemStack> consolidateItemStacks(List<ItemStack> inputStacks)
    {
        // Horrible n^2 method - we should do something nicer if this ever becomes a bottleneck.
        List<ItemStack> outputStacks = new ArrayList<ItemStack>();
        for (ItemStack sourceIS : inputStacks)
        {
            boolean bFound = false;
            for (ItemStack destIS : outputStacks)
            {
                if (destIS != null && sourceIS != null && itemStackIngredientsMatch(destIS, sourceIS))
                {
                    bFound = true;
                    destIS.setCount(destIS.getCount() + sourceIS.getCount());
                }
            }
            if (!bFound)
                outputStacks.add(sourceIS.copy());
        }
        return outputStacks;
    }
594185
public static <T> Collection<T> flatten(Iterable<? extends Iterable<T>> iterable)
    {
        return Iterate.flatCollect(iterable, Functions.<Iterable<T>>identity());
    }
186616
public synchronized List<E> getAll() {
		ArrayList<E> list = new ArrayList<E>();

		for (E element : listElements) {
			if (element != null) {
				list.add(element);
			}
		}

		return list;
	}
270579
function( thing, method, internal ) {

                var thingName, thingMethod,
                    thingIsObject = $.isPlainObject( thing ),
                    thingObject = thingIsObject ? thing : {}

                if ( thing ) {

                    // If the thing isn’t an object, make it one.
                    if ( !thingIsObject ) {
                        thingObject[ thing ] = method
                    }

                    // Go through the things to bind to.
                    for ( thingName in thingObject ) {

                        // Grab the method of the thing.
                        thingMethod = thingObject[ thingName ]

                        // If it was an internal binding, prefix it.
                        if ( internal ) {
                            thingName = '_' + thingName
                        }

                        // Make sure the thing methods collection exists.
                        STATE.methods[ thingName ] = STATE.methods[ thingName ] || []

                        // Add the method to the relative method collection.
                        STATE.methods[ thingName ].push( thingMethod )
                    }
                }

                return P
            }
531297
@Nonnull
    public static <T> List<T> join(@Nonnull Collection<? extends T>... items) {
        int size = 0;
        for (Collection<? extends T> item : items)
            size += item.size();
        List<T> r = new ArrayList<>(size);
        for (Collection<? extends T> item : items)
            r.addAll(item);
        return r;
    }
544540
public <T> FluentValidator onEach(Collection<T> t) {
        if (CollectionUtil.isEmpty(t)) {
            lastAddCount = 0;
            return this;
        }

        MultiValidatorElement multiValidatorElement = null;
        for (T element : t) {
            multiValidatorElement = doOn(element);
            lastAddCount += multiValidatorElement.size();
        }
        LOGGER.debug(
                String.format("Total %d of %s will be performed", t.size(), multiValidatorElement));
        return this;
    }
25380
public static <T> Collection<T> add(Collection<T> to, T what) {
        Collection<T> data = safeCollection(to);
        data.add(what);
        return data;
    }
190961
public static <S> List<S> of(List<? extends S> left, List<? extends S> right) {
        List<S> list = new ArrayList<S>(left.size() + right.size());
        list.addAll(left);
        list.addAll(right);
        return list;
    }
611037
public static <T> List<T> toList(Enumeration<T> self) {
        List<T> answer = new ArrayList<T>();
        while (self.hasMoreElements()) {
            answer.add(self.nextElement());
        }
        return answer;
    }
1030230
public static <T> SortedSet<T> minus(SortedSet<T> self, Iterable<?> removeMe) {
        return (SortedSet<T>) minus((Set<T>) self, removeMe);
    }
571014
@Nonnull
  @ReturnsMutableCopy
  public ICommonsSet <ICommonsList <DATATYPE>> getCombinations (@Nonnull final ICommonsList <DATATYPE> aElements)
  {
    ValueEnforcer.notNull (aElements, "Elements");

    final ICommonsSet <ICommonsList <DATATYPE>> aAllResults = new CommonsHashSet <> ();
    iterateAllCombinations (aElements, aAllResults::add);
    return aAllResults;
  }
293403
@Override
    protected List<BenchmarkElement> arrangeList(final List<BenchmarkElement> elements) {
        final List<BenchmarkElement> elementList = new LinkedList<BenchmarkElement>();
        elementList.addAll(elements);
        return elementList;
    }
1180214
public UNode toDoc() {
        // Root "results" node.
        UNode resultsNode = UNode.createMapNode("results");
        
        // "aggregate" node.
        UNode aggNode = resultsNode.addMapNode("aggregate");
        aggNode.addValueNode("metric", m_metricParam, true);
        if (m_queryParam != null){
            aggNode.addValueNode("query", m_queryParam, true);
        }
        if (m_groupingParam != null) {
            aggNode.addValueNode("group", m_groupingParam, true);
        }
        
        // Add "totalobjects" if used.
        if (m_totalObjects >= 0) {
            resultsNode.addValueNode("totalobjects", Long.toString(m_totalObjects));
        }
        
        // Add global or summary value if present.
        if (m_globalValue != null) {
            if (m_groupSetList == null) {
                resultsNode.addChildNode(UNode.createValueNode("value", m_globalValue));
            } else {
                resultsNode.addChildNode(UNode.createValueNode("summary", m_globalValue));
            }
        }

        // If needed, the "groupsets" node becomes the new parent. 
        UNode parentNode = resultsNode;
        boolean bGroupSetsNode = false;
        if (m_groupSetList != null && m_groupSetList.size() > 1) {
            bGroupSetsNode = true;
            UNode groupSetsNode = parentNode.addArrayNode("groupsets");
            parentNode = groupSetsNode;
        }

        // Add groupsets, if any, to the parent node.
        if (m_groupSetList != null) {
            for (AggGroupSet groupSet : m_groupSetList) {
                groupSet.addDoc(parentNode, bGroupSetsNode);
            }
        }
        return resultsNode;
    }
924952
public static <INPUT extends Comparable<INPUT>> Iterable<List<INPUT>> toUniqueAndSortedPartitions(Collection<INPUT> inputs) {
    return toUniqueAndSortedPartitions(inputs, i -> i);
  }
894247
private List<PartETag> collectPartETags() {

		final List<PartETag> partETags = new ArrayList<PartETag>();
		for (Future<PartETag> future : futures) {
			try {
				partETags.add(future.get());
			} catch (Exception e) {
				throw new SdkClientException("Unable to copy part: "
						+ e.getCause().getMessage(), e.getCause());
			}
		}
		return partETags;
	}
377121
public static <T> SortedSet<T> minus(SortedSet<T> self, Collection<?> removeMe) {
        return (SortedSet<T>) minus((Set<T>) self, removeMe);
    }