Module java.base
Package java.util

# Class Objects

≠
public final class Objects
extends java.lang.Object

## Methods

- =
  public static int checkFromIndexSize(int arg0, int arg1, int arg2)
- =
  public static long checkFromIndexSize(long arg0, long arg1, long arg2)
- =
  public static int checkFromToIndex(int arg0, int arg1, int arg2)
- =
  public static long checkFromToIndex(long arg0, long arg1, long arg2)
- =
  public static int checkIndex(int arg0, int arg1)
- =
  public static long checkIndex(long arg0, long arg1)
- =
  public static <T> int compare(T arg0, T arg1, java.util.Comparator<? super T> arg2)
- =
  public static boolean deepEquals(java.lang.Object arg0, java.lang.Object arg1)
- =
  public static boolean equals(java.lang.Object arg0, java.lang.Object arg1)
- +Only in: valhalla-csr-open; not in: jdk-master.
  public static boolean hasIdentity(java.lang.Object arg0)
  Not in jdk-master; only in valhalla-csr-open

  ### hasIdentity

  public static boolean hasIdentity(Object obj)
  `hasIdentity` is a preview API of the Java platform.
  Programs can only use `hasIdentity` when preview features are enabled.
  Preview features may be removed in a future release, or upgraded to permanent features of the Java platform.
  Returns `true` if the object is a non-null reference to an identity objectPREVIEW, otherwise `false`.
  API Note:
    If the parameter is `null`, there is no object and hence no class to check for identity; the return is `false`. To test for a value objectPREVIEW use:

            if (obj != null && !Objects.hasIdentity(obj)) {
                // obj is a non-null value object
            }

  Parameters:
    `obj` - an object or `null`
  Returns:
    `true` if the object is a non-null reference to an identity objectPREVIEW, otherwise `false`
  Since:
    Valhalla
- =
  public static int hash(java.lang.Object[] arg0)
- =
  public static int hashCode(java.lang.Object arg0)
- =
  public static boolean isNull(java.lang.Object arg0)
- +Only in: valhalla-csr-open; not in: jdk-master.
  public static boolean isValueObject(java.lang.Object arg0)
  Not in jdk-master; only in valhalla-csr-open

  ### isValueObject

  public static boolean isValueObject(Object obj)
  `isValueObject` is a preview API of the Java platform.
  Programs can only use `isValueObject` when preview features are enabled.
  Preview features may be removed in a future release, or upgraded to permanent features of the Java platform.
  Returns `true` if the object is a non-null reference to a value objectPREVIEW, otherwise `false`.
  Parameters:
    `obj` - an object or `null`
  Returns:
    `true` if the object is a non-null reference to a value objectPREVIEW, otherwise `false`
  Since:
    Valhalla
- =
  public static boolean nonNull(java.lang.Object arg0)
- +Only in: valhalla-csr-open; not in: jdk-master.
  public static <T> T requireIdentity(T arg0)
  Not in jdk-master; only in valhalla-csr-open

  ### requireIdentity

  public static <T> T requireIdentity(T obj)
  `requireIdentity` is a preview API of the Java platform.
  Programs can only use `requireIdentity` when preview features are enabled.
  Preview features may be removed in a future release, or upgraded to permanent features of the Java platform.
  Checks that the specified object reference is an identity object.
  Type Parameters:
    `T` - the type of the reference
  Parameters:
    `obj` - the object reference to check for identity
  Returns:
    `obj` if `obj` is an identity object
  Throws:
    `NullPointerException` - if `obj` is `null`
    `IdentityExceptionPREVIEW` - if `obj` is not an identity object
  Since:
    Valhalla
- +Only in: valhalla-csr-open; not in: jdk-master.
  public static <T> T requireIdentity(T arg0, java.lang.String arg1)
  Not in jdk-master; only in valhalla-csr-open

  ### requireIdentity

  public static <T> T requireIdentity(T obj, String message)
  `requireIdentity` is a preview API of the Java platform.
  Programs can only use `requireIdentity` when preview features are enabled.
  Preview features may be removed in a future release, or upgraded to permanent features of the Java platform.
  Checks that the specified object reference is an identity object.
  Type Parameters:
    `T` - the type of the reference
  Parameters:
    `obj` - the object reference to check for identity
    `message` - detail message to be used in the event that an `IdentityException` is thrown; may be null
  Returns:
    `obj` if `obj` is an identity object
  Throws:
    `NullPointerException` - if `obj` is `null`
    `IdentityExceptionPREVIEW` - if `obj` is not an identity object
  Since:
    Valhalla
- +Only in: valhalla-csr-open; not in: jdk-master.
  public static <T> T requireIdentity(T arg0, java.util.function.Supplier<java.lang.String> arg1)
  Not in jdk-master; only in valhalla-csr-open

  ### requireIdentity

  public static <T> T requireIdentity(T obj, Supplier<String> messageSupplier)
  `requireIdentity` is a preview API of the Java platform.
  Programs can only use `requireIdentity` when preview features are enabled.
  Preview features may be removed in a future release, or upgraded to permanent features of the Java platform.
  Checks that the specified object reference is an identity object.
  Type Parameters:
    `T` - the type of the reference
  Parameters:
    `obj` - the object reference to check for identity
    `messageSupplier` - supplier of the detail message to be used in the event that an `IdentityException` is thrown; may be null
  Returns:
    `obj` if `obj` is an identity object
  Throws:
    `NullPointerException` - if `obj` is `null`
    `IdentityExceptionPREVIEW` - if `obj` is not an identity object
  Since:
    Valhalla
- =
  public static <T> T requireNonNull(T arg0)
- =
  public static <T> T requireNonNull(T arg0, java.lang.String arg1)
- =
  public static <T> T requireNonNull(T arg0, java.util.function.Supplier<java.lang.String> arg1)
- =
  public static <T> T requireNonNullElse(T arg0, T arg1)
- =
  public static <T> T requireNonNullElseGet(T arg0, java.util.function.Supplier<? extends T> arg1)
- =
  public static java.lang.String toIdentityString(java.lang.Object arg0)
- =
  public static java.lang.String toString(java.lang.Object arg0)
- =
  public static java.lang.String toString(java.lang.Object arg0, java.lang.String arg1)

## Summary

Differences
| Elements | Comments | Descriptions | Total
Added | Changed | Removed | Added | Changed | Removed | Added | Changed | Removed
--- | --- | --- | --- | --- | --- | --- | --- | ---
hasIdentity(Object) | 1 |  |  |  |  |  | 1 |  |  | 2
isValueObject(Object) | 1 |  |  |  |  |  | 1 |  |  | 2
requireIdentity(T) | 1 |  |  |  |  |  | 1 |  |  | 2
requireIdentity(T,String) | 1 |  |  |  |  |  | 1 |  |  | 2
requireIdentity(T,Supplier) | 1 |  |  |  |  |  | 1 |  |  | 2
Total | 5 |  |  |  |  |  | 5 |  |  | 10