Java Number Equal areEqual(int o1, int o2)

Here you can find the source of areEqual(int o1, int o2)

Description

are Equal

License

Open Source License

Return

whether the two given int are equal.

Declaration

public static boolean areEqual(int o1, int o2) 

Method Source Code

//package com.java2s;
/*******************************************************************************
 * Copyright (c) 2007 Bruno Medeiros and other Contributors.
 * 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:// ww w .j a va 2  s .  co  m
 *     Bruno Medeiros - initial implementation
 *******************************************************************************/

public class Main {
    /** @return whether the two given objects are the same (including null) or equal. */
    public static boolean areEqual(Object o1, Object o2) {
        return (o1 == o2) || (o1 != null && o2 != null && o1.equals(o2));
    }

    /** @return whether the two given int are equal. */
    public static boolean areEqual(int o1, int o2) {
        return o1 == o2;
    }

    /** @return whether the two given floats are equal. */
    public static boolean areEqual(double o1, double o2) {
        return o1 == o2;
    }
}

Related

  1. areEqual(final boolean aThis, final boolean aThat)
  2. areEqual(final char aThis, final char aThat)
  3. areEqual(float left, float right)
  4. areEqual(int align, int mask)
  5. areEqual(int i, int j)
  6. areEqual(T s1, T s2)
  7. areEqual(T... elements)
  8. areEquals(boolean first, boolean second)
  9. areEquals(double p, double q)