Java Boolean From toBoolean(Object o)

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

Description

to Boolean

License

Open Source License

Declaration

public static Boolean toBoolean(Object o) 

Method Source Code

//package com.java2s;

public class Main {
    public static Boolean toBoolean(Object o) {
        Boolean b;/*from  ww  w  . jav a2 s . c  o m*/
        if (o instanceof Boolean) {
            b = (Boolean) o;
        } else {
            String s = o.toString();
            if (s.equalsIgnoreCase("true")) {
                b = Boolean.TRUE;
            } else if (s.equalsIgnoreCase("false")) {
                b = Boolean.FALSE;
            } else {
                b = null;
            }
        }
        return b;
    }
}

Related

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