Java Collection Contain containsAll(final Collection c, final Object... array)

Here you can find the source of containsAll(final Collection c, final Object... array)

Description

contains All

License

Open Source License

Declaration

public static boolean containsAll(final Collection<?> c, final Object... array) 

Method Source Code


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

import java.util.Collection;

public class Main {
    public static boolean containsAll(final Collection<?> c, final Object... array) {
        for (int i = 0; i < array.length; i++) {
            if (!c.contains(array[i])) {
                return false;
            }/*from  w  ww .ja  v a2 s  .c  o m*/
        }

        return true;
    }

    public static boolean containsAll(final Collection<? super Boolean> c, final boolean... array) {
        for (int i = 0; i < array.length; i++) {
            if (!c.contains(array[i])) {
                return false;
            }
        }

        return true;
    }

    public static boolean containsAll(final Collection<? super Byte> c, final byte... array) {
        for (int i = 0; i < array.length; i++) {
            if (!c.contains(array[i])) {
                return false;
            }
        }

        return true;
    }

    public static boolean containsAll(final Collection<? super Character> c, final char... array) {
        for (int i = 0; i < array.length; i++) {
            if (!c.contains(array[i])) {
                return false;
            }
        }

        return true;
    }

    public static boolean containsAll(final Collection<? super Short> c, final short... array) {
        for (int i = 0; i < array.length; i++) {
            if (!c.contains(array[i])) {
                return false;
            }
        }

        return true;
    }

    public static boolean containsAll(final Collection<? super Integer> c, final int... array) {
        for (int i = 0; i < array.length; i++) {
            if (!c.contains(array[i])) {
                return false;
            }
        }

        return true;
    }

    public static boolean containsAll(final Collection<? super Long> c, final long... array) {
        for (int i = 0; i < array.length; i++) {
            if (!c.contains(array[i])) {
                return false;
            }
        }

        return true;
    }

    public static boolean containsAll(final Collection<? super Float> c, final float... array) {
        for (int i = 0; i < array.length; i++) {
            if (!c.contains(array[i])) {
                return false;
            }
        }

        return true;
    }

    public static boolean containsAll(final Collection<? super Double> c, final double... array) {
        for (int i = 0; i < array.length; i++) {
            if (!c.contains(array[i])) {
                return false;
            }
        }

        return true;
    }

    public static boolean containsAll(final Collection<?> c, final Object[] array, final int off, final int len) {
        final int end = off + len;

        for (int i = off; i < end; i++) {
            if (!c.contains(array[i])) {
                return false;
            }
        }

        return true;
    }

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

        for (int i = off; i < end; i++) {
            if (!c.contains(array[i])) {
                return false;
            }
        }

        return true;
    }

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

        for (int i = off; i < end; i++) {
            if (!c.contains(array[i])) {
                return false;
            }
        }

        return true;
    }

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

        for (int i = off; i < end; i++) {
            if (!c.contains(array[i])) {
                return false;
            }
        }

        return true;
    }

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

        for (int i = off; i < end; i++) {
            if (!c.contains(array[i])) {
                return false;
            }
        }

        return true;
    }

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

        for (int i = off; i < end; i++) {
            if (!c.contains(array[i])) {
                return false;
            }
        }

        return true;
    }

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

        for (int i = off; i < end; i++) {
            if (!c.contains(array[i])) {
                return false;
            }
        }

        return true;
    }

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

        for (int i = off; i < end; i++) {
            if (!c.contains(array[i])) {
                return false;
            }
        }

        return true;
    }

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

        for (int i = off; i < end; i++) {
            if (!c.contains(array[i])) {
                return false;
            }
        }

        return true;
    }
}

Related

  1. contains(final Collection c, final T o)
  2. contains(Object o, Collection c)
  3. containsAll(Collection c, Iterable subset)
  4. containsAll(Collection coll, Collection other)
  5. containsAll(Collection collectionToCheck, Collection items)
  6. containsAll(final Collection coll1, final Collection coll2)
  7. containSameElements(Collection> sets)
  8. containSameItems(Collection c1, Collection c2)
  9. containsAny(Collection c1, Collection c2)