Java Array Value Any anyNoneNull(String... arrays)

Here you can find the source of anyNoneNull(String... arrays)

Description

any None Null

License

Open Source License

Declaration

public static String anyNoneNull(String... arrays) 

Method Source Code

//package com.java2s;

public class Main {
    public static final String EMPTY_STRING = "";

    public static String anyNoneNull(String... arrays) {
        if (null == arrays || 0 >= arrays.length) {
            return EMPTY_STRING;
        }/* w w  w .j a v a 2s .c  om*/
        for (String string : arrays) {
            if (isNotBlank(string)) {
                return string.trim();
            }
        }

        return EMPTY_STRING;
    }

    public static boolean isNotBlank(String str) {
        return !isBlank(str);
    }

    public static boolean isNotBlank(String... arrays) {
        for (String string : arrays) {
            if (isBlank(string)) {
                return false;
            }
        }
        return true;
    }

    public static boolean isBlank(String str) {
        int strLen;
        if (str == null || (strLen = str.length()) == 0) {
            return true;
        }
        for (int i = 0; i < strLen; i++) {
            if ((Character.isWhitespace(str.charAt(i)) == false)) {
                return false;
            }
        }
        return true;
    }
}

Related

  1. anyEqual(int item, int... expected)
  2. anyInherit(Class cl, Class[] otherClasses)
  3. anyInstance(Throwable t, Class[] types)
  4. anyIsTrue(Boolean... conditions)
  5. anyMore(int[] target, int[] test)
  6. anyNotNull(final Object... values)
  7. anyNotNull(Object... tests)
  8. anyNull(Object... args)
  9. anyNull(Object... args)