判断为null

public static boolean isEmpty(Map map) {
        if (null == map) {
            return true;
        }

        return map.isEmpty();
    }

    public static boolean isEmpty(Collection collection) {
        if (null == collection) {
            return true;
        }

        return collection.isEmpty();
    }

你可能感兴趣的:(判断为null)