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;

public class Main {
    /**
     * parse value to boolean
     */
    public static boolean toBoolean(Object value) {
        if (value instanceof Boolean) {
            return (Boolean) value;
        }
        return value == null ? false : toBoolean(String.valueOf(value));
    }

    /**
     * parse value to boolean
     */
    public static boolean toBoolean(String value) {
        return TextUtils.isEmpty(value) ? false : Boolean.parseBoolean(value);
    }
}