Java Number Equal areEquals(boolean first, boolean second)

Here you can find the source of areEquals(boolean first, boolean second)

Description

are Equals

License

Open Source License

Declaration

public static boolean areEquals(boolean first, boolean second) 

Method Source Code

//package com.java2s;
/*******************************************************************************
 * Copyright (c) 2008 Olivier Moises/* w  w  w  .jav a  2 s.c om*/
 *
 * 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:
 *   Olivier Moises- initial API and implementation
 *******************************************************************************/

public class Main {
    public static boolean areEquals(boolean first, boolean second) {
        return first == second;
    }

    public static boolean areEquals(int first, int second) {
        return first == second;
    }

    public static boolean areEquals(short first, short second) {
        return first == second;
    }

    public static boolean areEquals(String first, String second) {
        if (first == null && second == null)
            return true;
        if (first != null && first.equals(second))
            return true;
        if (second != null && second.equals(first))
            return true;
        return false;
    }
}

Related

  1. areEqual(int align, int mask)
  2. areEqual(int i, int j)
  3. areEqual(int o1, int o2)
  4. areEqual(T s1, T s2)
  5. areEqual(T... elements)
  6. areEquals(double p, double q)