Equality.java

  1. /*
  2.  * Copyright (C) 2022, Fabio Ponciroli <ponch78@gmail.com> and others
  3.  *
  4.  * This program and the accompanying materials are made available under the
  5.  * terms of the Eclipse Distribution License v. 1.0 which is available at
  6.  * https://www.eclipse.org/org/documents/edl-v10.php.
  7.  *
  8.  * SPDX-License-Identifier: BSD-3-Clause
  9.  */

  10. package org.eclipse.jgit.util;

  11. /**
  12.  * Equality utilities.
  13.  *
  14.  * @since: 6.2
  15.  */
  16. public class Equality {

  17.     /**
  18.      * Compare by reference
  19.      *
  20.      * @param a
  21.      *            First object to compare
  22.      * @param b
  23.      *            Second object to compare
  24.      * @return {@code true} if the objects are identical, {@code false}
  25.      *         otherwise
  26.      *
  27.      * @since 6.2
  28.      */
  29.     @SuppressWarnings("ReferenceEquality")
  30.     public static <T> boolean isSameInstance(T a, T b) {
  31.         return a == b;
  32.     }
  33. }