Java Boolean From toBoolean(final Boolean bool)

Here you can find the source of toBoolean(final Boolean bool)

Description

Method to convert Boolean object to boolean primitive

License

Open Source License

Parameter

Parameter Description
bool a parameter

Return

boolean

Declaration

public static boolean toBoolean(final Boolean bool) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

public class Main {
    /**//from   w  w  w . j a  va  2  s  . c  om
     * Method to convert Boolean object to boolean primitive
     * 
     * @param bool
     * @return {@link boolean}
     */
    public static boolean toBoolean(final Boolean bool) {
        return bool != null && bool.booleanValue();
    }

    /**
     * Method to convert int to boolean
     * 
     * @param val
     * @return {@link boolean}
     */
    public static boolean toBoolean(final int val) {
        return val != 0;
    }
}

Related

  1. toBoolean(byte[] bytes, int offset)
  2. toBoolean(byte[] data, int offset)
  3. toBoolean(byte[] value)
  4. toBoolean(char c)
  5. toBoolean(double value)
  6. toBoolean(final Boolean bool)
  7. toBoolean(final byte[] b)
  8. toBoolean(final Object obj, final boolean defaultValue)
  9. toBoolean(final Object value)