Java Boolean From toBoolean(Object obj)

Here you can find the source of toBoolean(Object obj)

Description

Get the boolean value of this object, only if the object is an instance of Boolean

License

Open Source License

Parameter

Parameter Description
obj the object to be converted

Return

the boolean value of the object, or false if it is not a boolean.

Declaration

public static boolean toBoolean(Object obj) 

Method Source Code

//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;
    }
}

Related

  1. toBoolean(Object obj)
  2. toBoolean(Object obj)
  3. toBoolean(Object obj)
  4. toBoolean(Object obj)
  5. toBoolean(Object obj)
  6. toBoolean(Object obj)
  7. toBoolean(Object obj)
  8. toBoolean(Object obj)
  9. toBoolean(Object obj)