Performs an external merge on the values in the iterator.
@param values Iterator containing the data to sort.
@return an iterator the iterates over the sorted result.
@throws IOException if something fails when doing I/O.
546972
public CloseableIterator<T> mergeSort(Iterator<T> values) throws IOException {
        ChunkSizeIterator<T> csi = new ChunkSizeIterator<T>(values, config.chunkSize);
        if (csi.isMultipleChunks()) {
            List<File> sortedChunks = writeSortedChunks(csi);
            return mergeSortedChunks(sortedChunks);
        } else {
            if (config.distinct) {
                SortedSet<T> list = new TreeSet<T>(comparator);
                while (csi.hasNext()) {
                    list.add(csi.next());
                }
                return new DelegatingMergeIterator<T>(list.iterator());
            } else {
                List<T> list = new ArrayList<T>(csi.getHeadSize());
                while (csi.hasNext()) {
                    list.add(csi.next());
                }
                Collections.sort(list, comparator);
                return new DelegatingMergeIterator<T>(list.iterator());
            }
        }
    }
606604
static <T> Set<T> reduceSet(Iterator<Set<T>> values) {
        Set<T> set = new HashSet<>();
        while (values.hasNext()) {
            set.addAll(values.next());
        }
        return set;
    }
492768
public static <T> List<T> asArrayList(T[] values) {
    ArrayList<T> result = new ArrayList<T>();
    Collections.addAll(result, values);

    return result;
  }
927150
public static <K, V, M extends Map<K, V>> M putAll (
        M map, Iterable<? extends Map<? extends K, ? extends V>> values)
    {
        for (Map<? extends K, ? extends V> val : values) {
            map.putAll(val);
        }
        return map;
    }
100196
public static <E extends Comparable<E>> void sort(E[] intArray) {
        Merge.sort(intArray, 0, intArray.length-1, false);
    }
1109082
public Option series(Series... values) {
        if (values == null || values.length == 0) {
            return this;
        }
        this.series().addAll(Arrays.asList(values));
        return this;
    }
1266522
public CsvWriter<T> append(T value) throws IOException {
        try {
            mapper.mapTo(value, appendable, mappingContext);
        } catch(Exception e) {
            ErrorHelper.rethrow(e);
        }
        return this;
    }
45792
protected static String join(String... values) {
		final StringBuilder buffer = new StringBuilder();
		for (final String value : values) {
			if (!Strings.isNullOrEmpty(value)) {
				if (buffer.length() > 0) {
					buffer.append(" "); //$NON-NLS-1$
				}
				buffer.append(value);
			}
		}
		return buffer.toString();
	}
667513
public void add(IntArrayList values) {
        ensureCapacity(size + values.size);
        for (int i=0; i<values.size; i++) {
            this.add(values.elements[i]);
        }
    }
1374003
public function mergeAll(array $values)
    {
        foreach ($values as $key => $value) {
            $this->merge($key, $value);
        }
    }
1003040
public static <T> Iterator<T> merge(Comparator<T> comp, Iterator<T>... iterators)
    {
        switch (iterators.length)
        {
            case 0:
                throw new IllegalArgumentException("no iterables");
            case 1:
                return iterators[0];
            case 2:
                return new IteratorImpl<>(comp, iterators[0], iterators[1]);
            default:
                return new IteratorImpl<>(comp, iterators[0], merge(comp, Arrays.copyOfRange(iterators, 1, iterators.length)));
        }
    }
288410
public static <K, V> Map<K, V> newCombinedMap(K[] keys,
            V[] values) {
        HashMap<K, V> map = new HashMap<>();
        for (int i = 0; i < keys.length; i++)
            map.put(keys[i], getValueOfIndex(values, i));
        return map;
    }
1296965
public ListOrdersRequest withFulfillmentChannel(String... values) {
        List<String> list = getFulfillmentChannel();
        for (String value : values) {
            list.add(value);
        }
        return this;
    }
1311284
public static <T> Iterable<T> merge(Iterable<T>... iterables)
    {
        return merge(null, iterables);
    }
601631
public static <T> T randomOne(T... values) {
		return (T) values[RANDOM.nextInt(values.length)];
	}
912891
public static String joinP(String delimiter, int... values) {
        StringBuilder builder = new StringBuilder(values.length + (delimiter.length() * values.length));
        boolean first = true;
        for (int i : values) {
            if (first) {
                first = false;
            } else {
                builder.append(delimiter);
            }
            builder.append(Integer.toString(i));
        }
        return builder.toString();
    }
498236
@Override
    public void putAll(final T[] values) {
        if (values == null || values.length == 0) {
            return;
        }
        for (final T value : values) {
            put(value);
        }
    }