Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;

import java.util.Collection;

public class Main {

    public static boolean isEmpty(String str) {
        return str == null ? true : ("".equals(str.trim()) ? true : false);
    }

    public static boolean isEmpty(Object str) {
        return str == null ? true : false;
    }

    public static <T> Boolean isEmpty(T[] arr) {
        if (arr == null || arr.length < 1) {
            return Boolean.TRUE;
        }
        return Boolean.FALSE;
    }

    public static Boolean isEmpty(int[] arr) {
        if (arr == null || arr.length < 1) {
            return Boolean.TRUE;
        }
        return Boolean.FALSE;
    }

    public static Boolean isEmpty(Collection<?> collection) {
        if (collection == null || collection.size() < 1) {
            return Boolean.TRUE;
        }
        return Boolean.FALSE;
    }
}