Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
//License from project: Apache License 

import android.text.TextUtils;

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

public class Main {

    public static String hideName(String string) {

        if (!TextUtils.isEmpty(string)) {
            int length = string.length();
            if (length > 1) {
                string = string.substring(0, 1);
                string = string + (length > 2 ? "**" : "*");
            }
        }
        return string;
    }

    /**
     * List Map Object is Empty
     * @param object Object
     * @return boolean
     */
    public static boolean isEmpty(Object object) {
        if (object instanceof List) {
            return ((List) object).size() < 1;
        } else if (object instanceof Map) {
            return ((Map) object).size() < 1;
        }
        return object == null;
    }
}