Java Array Empty Check hasOneEmpty(String[] args)

Here you can find the source of hasOneEmpty(String[] args)

Description

has One Empty

License

Open Source License

Declaration

public static boolean hasOneEmpty(String[] args) 

Method Source Code


//package com.java2s;
import java.util.Collection;
import java.util.Map;

public class Main {

    public static boolean hasOneEmpty(String[] args) {
        if (args == null)
            return false;
        for (int i = 0; i < args.length; i++) {
            if (isEmpty(args[i]))
                return true;
        }/*from ww  w  . j a  v a  2 s.  c o m*/
        return false;
    }

    public static boolean isEmpty(String str) {
        return str == null || str.length() < 1;
    }

    public static boolean isEmpty(Object[] arrs) {
        return arrs == null || arrs.length < 1;
    }

    public static boolean isEmpty(Collection colls) {
        return colls == null || colls.isEmpty();
    }

    public static boolean isEmpty(Map map) {
        return map == null || map.isEmpty();
    }
}

Related

  1. areArraysEqual(byte[] arr1, byte[] arr2, boolean dontDistinctNilAndEmpty)
  2. getNonemptySubsets(Object[] objects)
  3. getWithoutEmptyParams(String[] cmdarray)
  4. isEmpty(boolean[] values)
  5. isEmpty(byte[] array)
  6. isEmpty(E[] array)
  7. isEmpty(final int[] arr)