References.java

  1. /*
  2.  * Copyright (C) 2019, Matthias Sohn <matthias.sohn@sap.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.  * Utility methods for object references
  13.  *
  14.  * @since 5.4
  15.  */
  16. public interface References {

  17.     /**
  18.      * Compare two references
  19.      *
  20.      * @param <T>
  21.      *            type of the references
  22.      * @param ref1
  23.      *            first reference
  24.      * @param ref2
  25.      *            second reference
  26.      * @return {@code true} if both references refer to the same object
  27.      */
  28.     @SuppressWarnings("ReferenceEquality")
  29.     public static <T> boolean isSameObject(T ref1, T ref2) {
  30.         return ref1 == ref2;
  31.     }
  32. }