Here you can find the source of toBoolean(Object obj)
Parameter | Description |
---|---|
obj | the object to be converted |
public static boolean toBoolean(Object obj)
//package com.java2s; public class Main { /**/*from w w w . j ava 2 s . com*/ * Get the boolean value of this object, only if the object is an instance of Boolean * * @param obj the object to be converted * @return the boolean value of the object, or false if it is not a boolean. */ public static boolean toBoolean(Object obj) { return (obj instanceof Boolean) ? ((Boolean) obj).booleanValue() : false; } }