Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;

import java.util.List;
import java.util.Map;

public class Main {

    public static int length(Object[] objs) {
        return isEmpty(objs) ? 0 : objs.length;
    }

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

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

    public static boolean isEmpty(int[] array) {
        if (array == null || array.length < 1)
            return true;
        return false;
    }

    public static boolean isEmpty(byte[] array) {
        if (array == null || array.length < 1)
            return true;
        return false;
    }

    @SuppressWarnings("rawtypes")
    public static boolean isEmpty(List list) {
        if (null == list || "".equals(list) || list.size() < 1)
            return true;
        return false;
    }

    @SuppressWarnings("rawtypes")
    public static boolean isEmpty(Map map) {
        if (null == map || "".equals(map) || map.size() < 1)
            return true;
        return false;
    }
}