Java Collection Empty nullOrEmpty(final Collection in)

Here you can find the source of nullOrEmpty(final Collection in)

Description

null Or Empty

License

Apache License

Declaration

public static <E> boolean nullOrEmpty(final Collection<E> in) 

Method Source Code


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

import java.util.Collection;
import java.util.Map;

public class Main {
    public static boolean nullOrEmpty(String in) {
        if ((in == null) || (in.isEmpty())) {
            return true;
        }//from   w w  w .  j  av  a  2 s .c  om
        return false;
    }

    public static <E> boolean nullOrEmpty(final Collection<E> in) {
        if ((in == null) || (in.isEmpty())) {
            return true;
        }
        return false;
    }

    public static <E, V> boolean nullOrEmpty(final Map<E, V> in) {
        if ((in == null) || (in.isEmpty())) {
            return true;
        }
        return false;
    }

    public static <T> boolean nullOrEmpty(T[] in) {
        if ((in == null) || (in.length == 0)) {
            return true;
        }
        return false;
    }

    public static boolean nullOrEmpty(byte[] in) {
        if ((in == null) || (in.length == 0)) {
            return true;
        }
        return false;
    }

    public static boolean nullOrEmpty(short[] in) {
        if ((in == null) || (in.length == 0)) {
            return true;
        }
        return false;
    }

    public static boolean nullOrEmpty(int[] in) {
        if ((in == null) || (in.length == 0)) {
            return true;
        }
        return false;
    }

    public static boolean nullOrEmpty(long[] in) {
        if ((in == null) || (in.length == 0)) {
            return true;
        }
        return false;
    }

    public static boolean nullOrEmpty(float[] in) {
        if ((in == null) || (in.length == 0)) {
            return true;
        }
        return false;
    }

    public static boolean nullOrEmpty(double[] in) {
        if ((in == null) || (in.length == 0)) {
            return true;
        }
        return false;
    }

    public static boolean nullOrEmpty(boolean[] in) {
        if ((in == null) || (in.length == 0)) {
            return true;
        }
        return false;
    }

    public static boolean nullOrEmpty(char[] in) {
        if ((in == null) || (in.length == 0)) {
            return true;
        }
        return false;
    }
}

Related

  1. isNullOrEmpty(final Collection collection)
  2. isNullOrEmpty(T collection)
  3. nullOrEmpty(Collection coll)
  4. nullOrEmpty(Collection tested)
  5. nullOrEmpty(Collection c)
  6. nullOrEmptyToDefault(final Collection collection, final Collection defaultValue)
  7. nullToEmpty(Collection c)
  8. nullToEmpty(Collection coll)
  9. orEmpty(T collection)