Java Boolean Invert invert(boolean b)

Here you can find the source of invert(boolean b)

Description

Inverts the boolean input (true, false).
Namely, if the input is true returns false and if the input is false returns true.

License

Open Source License

Parameter

Parameter Description
b The boolean symbol which will be inverted.

Return

The inverse of the input.

Declaration

public static boolean invert(boolean b) 

Method Source Code

//package com.java2s;
/**//  w  w  w . j a va 2s .  c  o m
 * Project: JavaGE Library
 * Author:  Loukas Georgiou
 * Date:   14 Jan 2006
 * 
 * Copyright 2006, 2008 Loukas Georgiou.
 * This file is part of JavaGE (jGE) Library.
 * 
 * jGE Library is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
    
 * jGE Library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
    
 * You should have received a copy of the GNU General Public License
 * along with jGE Library.  If not, see <http://www.gnu.org/licenses/>.
 */

public class Main {
    /**
     * Inverts the boolean input (true, false).<br>
     * Namely, if the input is <code>true</code> returns <code>false</code>
     * and if the input is <code>false</code> returns <code>true</code>. 
     * 
     * @param b The boolean symbol which will be inverted.
     * @return The inverse of the input.
     */
    public static boolean invert(boolean b) {
        return !b;
    }
}

Related

  1. invertLogic(final boolean logic, final boolean invert)