Java Array Empty Check isNullOrEmptyOrFirstElementBlank(String[] values)

Here you can find the source of isNullOrEmptyOrFirstElementBlank(String[] values)

Description

is Null Or Empty Or First Element Blank

License

Open Source License

Declaration

public static boolean isNullOrEmptyOrFirstElementBlank(String[] values) 

Method Source Code

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

import java.util.Arrays;
import java.util.Collection;

import java.util.List;

public class Main {
    public static boolean isNullOrEmptyOrFirstElementBlank(String[] values) {
        return isArrayNullOrEmpty(values) || values[0].equals("");
    }//  w ww . ja  va2  s  .c o m

    public static boolean isArrayNullOrEmpty(String[] values) {
        return values == null || values.length == 0;
    }

    /**
     * Compare a collection of strings to an array of strings.
     */
    public static boolean equals(Collection<String> asCollection, String[] values) {
        final List<String> asList = Arrays.asList(values);
        final boolean containsAll = asCollection.containsAll(asList);
        final int size = asCollection.size();
        final int length = values.length;
        return containsAll && length == size;
    }
}

Related

  1. isNotNullAndNotEmpty(final Object[] array)
  2. isNotNullOrEmpty(T[] array)
  3. isNullOrEmpty(Object[] array)
  4. isNullOrEmpty(String[] s)
  5. isNullOrEmpty(T[] array)
  6. normalizeTokens(String[] tokens, boolean removeEmpty)
  7. nullOrEmpty(Object[] array)
  8. removeEmpty(String[] strings)
  9. removeEmptyElements(String[] firstArray)