Java Array Empty Check isEmpty(final int[] arr)

Here you can find the source of isEmpty(final int[] arr)

Description

is Empty

License

Open Source License

Declaration

public static boolean isEmpty(final int[] arr) 

Method Source Code

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

import java.util.List;

public class Main {
    /**/* ww  w  .  ja va  2 s  .  c  o m*/
     * Checks if is null or empty.
     * 
     * @param input
     *            List<T> :  list
     * @return true, if input is null or Empty
     */
    public static <T> boolean isEmpty(final List<T> list) {
        return list == null || list.isEmpty();
    }

    /**
     * Checks if is null or empty.
     * 
     * @param input
     *            String :  str
     * @return true, if input is null or Zero
     */
    public static boolean isEmpty(final String str) {
        return str == null || str.trim().length() == 0;
    }

    /**
     * Checks if is null or empty.
     * 
     * @param input
     *            Integer :  value
     * @return true, input if is null or Zero
     */
    public static boolean isEmpty(final Integer value) {
        return value == null || value.intValue() == 0;
    }

    public static boolean isEmpty(final int[] arr) {
        return arr.length == 0;
    }

    /**
     * Checks if is null or Zero.
     * 
     * @param input
     *            the value
     * @return true, if input is null or Zero.
     */
    public static boolean isEmpty(final Short value) {
        return value == null || value.intValue() == 0;
    }

    /**
     * Checks if an array of String is empty
     * @param strArr
     * @return true, if input empty.
     */
    public static boolean isEmpty(final String[] strArr) {
        return strArr.length == 0;
    }
}

Related

  1. getWithoutEmptyParams(String[] cmdarray)
  2. hasOneEmpty(String[] args)
  3. isEmpty(boolean[] values)
  4. isEmpty(byte[] array)
  5. isEmpty(E[] array)
  6. isEmpty(final Object[] array)
  7. isEmpty(final X[] array)
  8. isEmpty(int[] array)
  9. isEmpty(int[] array)