Java Collection Copy copyRemainder(final T[] sourceArray, final int startIndex, final Collection collector)

Here you can find the source of copyRemainder(final T[] sourceArray, final int startIndex, final Collection collector)

Description

Adds all elements of the given array to the collector, starting from the given index.

License

Apache License

Parameter

Parameter Description
sourceArray is the source array to copy from
startIndex is an index in the array from which the copying shall start
collector collects the copied elements

Declaration

private static <T> void copyRemainder(final T[] sourceArray, final int startIndex,
        final Collection<T> collector) 

Method Source Code

//package com.java2s;
//License from project: Apache License 

import java.util.*;

public class Main {
    /**//from   w w  w . j  a v a  2 s . c  o m
     * Adds all elements of the given array to the collector, starting from the given index.
     * 
     * @param sourceArray
     *        is the source array to copy from
     * @param startIndex
     *        is an index in the array from which the copying shall start
     * @param collector
     *        collects the copied elements
     */
    private static <T> void copyRemainder(final T[] sourceArray, final int startIndex,
            final Collection<T> collector) {

        for (int index = startIndex; index < sourceArray.length; index++) {
            collector.add(sourceArray[index]);
        }
    }
}

Related

  1. copy(final Collection collection)
  2. copy2Collection(Object[] strs)
  3. copyColl(Collection out, Iterable set)
  4. copyIntoCollectionFrom(Collection collection, Iterable iterable)
  5. copyNSorted(final Collection source, final Collection dest, final Comparator order, final int n)
  6. copyStringCollection(Collection strings)
  7. copyWithoutNull(Collection orig)
  8. createSet(Collection toCopy)
  9. maskedCopyOf(final Collection source, final Collection mask)