Java Boolean From toBoolean(boolean bool)

Here you can find the source of toBoolean(boolean bool)

Description

Converts a boolean value into Boolean.

License

Open Source License

Parameter

Parameter Description
bool The boolean to convert

Return

The corresponding Boolean object (TRUE or FALSE).

Declaration

public static Boolean toBoolean(boolean bool) 

Method Source Code

//package com.java2s;
/*******************************************************************************
 * Copyright (c) 2000, 2011 IBM Corporation and others.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 * Contributors://www  . j  a v a2 s. c  o m
 *     IBM Corporation - initial API and implementation
 *******************************************************************************/

public class Main {
    /**
     * Converts a boolean value into Boolean.
     * @param bool The boolean to convert
     * @return The corresponding Boolean object (TRUE or FALSE).
     */
    public static Boolean toBoolean(boolean bool) {
        if (bool) {
            return Boolean.TRUE;
        } else {
            return Boolean.FALSE;
        }
    }
}

Related

  1. toBool(String v, boolean def)
  2. toBool(String val)
  3. toBool(String val, boolean def)
  4. toBoolean(boolean b)
  5. toBoolean(Boolean bool)
  6. toBoolean(Boolean bool)
  7. toBoolean(Boolean bool, boolean defaultValue)
  8. toBoolean(byte b)
  9. toBoolean(byte data[], int offset, boolean value)