Java Collection Add addAll(final Collection c, final E... array)

Here you can find the source of addAll(final Collection c, final E... array)

Description

add All

License

Open Source License

Declaration

public static <E> boolean addAll(final Collection<? super E> c, final E... array) 

Method Source Code


//package com.java2s;
//License from project: Open Source License 

import java.util.Collection;

public class Main {
    public static <E> boolean addAll(final Collection<? super E> c, final E... array) {
        boolean result = false;

        for (final E element : array) {
            result |= c.add(element);/* w  w w  .  j  av  a2 s. c  o  m*/
        }

        return result;
    }

    public static boolean addAll(final Collection<? super Boolean> c, final boolean... array) {
        boolean result = false;

        for (final boolean element : array) {
            result |= c.add(element);
        }

        return result;
    }

    public static boolean addAll(final Collection<? super Byte> c, final byte... array) {
        boolean result = false;

        for (final byte element : array) {
            result |= c.add(element);
        }

        return result;
    }

    public static boolean addAll(final Collection<? super Character> c, final char... array) {
        boolean result = false;

        for (final char element : array) {
            result |= c.add(element);
        }

        return result;
    }

    public static boolean addAll(final Collection<? super Short> c, final short... array) {
        boolean result = false;

        for (final short element : array) {
            result |= c.add(element);
        }

        return result;
    }

    public static boolean addAll(final Collection<? super Integer> c, final int... array) {
        boolean result = false;

        for (final int element : array) {
            result |= c.add(element);
        }

        return result;
    }

    public static boolean addAll(final Collection<? super Long> c, final long... array) {
        boolean result = false;

        for (final long element : array) {
            result |= c.add(element);
        }

        return result;
    }

    public static boolean addAll(final Collection<? super Float> c, final float... array) {
        boolean result = false;

        for (final float element : array) {
            result |= c.add(element);
        }

        return result;
    }

    public static boolean addAll(final Collection<? super Double> c, final double... array) {
        boolean result = false;

        for (final double element : array) {
            result |= c.add(element);
        }

        return result;
    }

    public static <E> boolean addAll(final Collection<? super E> c, final E[] array, final int off, final int len) {
        final int end = off + len;
        boolean result = false;

        for (int i = off; i < end; i++) {
            result |= c.add(array[i]);
        }

        return result;
    }

    public static boolean addAll(final Collection<? super Boolean> c, final boolean[] array, final int off,
            final int len) {
        final int end = off + len;
        boolean result = false;

        for (int i = off; i < end; i++) {
            result |= c.add(array[i]);
        }

        return result;
    }

    public static boolean addAll(final Collection<? super Byte> c, final byte[] array, final int off,
            final int len) {
        final int end = off + len;
        boolean result = false;

        for (int i = off; i < end; i++) {
            result |= c.add(array[i]);
        }

        return result;
    }

    public static boolean addAll(final Collection<? super Character> c, final char[] array, final int off,
            final int len) {
        final int end = off + len;
        boolean result = false;

        for (int i = off; i < end; i++) {
            result |= c.add(array[i]);
        }

        return result;
    }

    public static boolean addAll(final Collection<? super Short> c, final short[] array, final int off,
            final int len) {
        final int end = off + len;
        boolean result = false;

        for (int i = off; i < end; i++) {
            result |= c.add(array[i]);
        }

        return result;
    }

    public static boolean addAll(final Collection<? super Integer> c, final int[] array, final int off,
            final int len) {
        final int end = off + len;
        boolean result = false;

        for (int i = off; i < end; i++) {
            result |= c.add(array[i]);
        }

        return result;
    }

    public static boolean addAll(final Collection<? super Long> c, final long[] array, final int off,
            final int len) {
        final int end = off + len;
        boolean result = false;

        for (int i = off; i < end; i++) {
            result |= c.add(array[i]);
        }

        return result;
    }

    public static boolean addAll(final Collection<? super Float> c, final float[] array, final int off,
            final int len) {
        final int end = off + len;
        boolean result = false;

        for (int i = off; i < end; i++) {
            result |= c.add(array[i]);
        }

        return result;
    }

    public static boolean addAll(final Collection<? super Double> c, final double[] array, final int off,
            final int len) {
        final int end = off + len;
        boolean result = false;

        for (int i = off; i < end; i++) {
            result |= c.add(array[i]);
        }

        return result;
    }
}

Related

  1. addAll(Collection target, Collection source)
  2. addAll(Collection target, Iterable source)
  3. addAll(Collection target, S[] source)
  4. addAll(final Collection coll, final Object[] array)
  5. addAll(final Collection newItems, final Collection existingItems)
  6. addAll(final Collection thingsToBeAddedTo, final Collection thingsToAdd)
  7. addAll(final Collection coll, final T... objs)
  8. addAll(final Collection collection, final T... elements)
  9. addAll(final Collection collection, final T... objects)