Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//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);
        }

        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;
    }
}