RenderingHints.Key (Java SE 26 & JDK 26)
Description: declaration: module: java.desktop, package: java.awt, class: RenderingHints, class: Key
Keywords: java.awt.RenderingHints.Key class

# Class RenderingHints.Key

java.lang.Object
java.awt.RenderingHints.Key

Enclosing class:
  `RenderingHints`

public abstract static class RenderingHints.Key extends Object
Defines the base type of all keys used along with the `RenderingHints` class to control various algorithm choices in the rendering and imaging pipelines. Instances of this class are immutable and unique which means that tests for matches can be made using the `==` operator instead of the more expensive `equals()` method.

- ## Constructor Summary

  Constructors
  Modifier
  Constructor
  Description
  `protected`
  `Key(int privatekey)`
  Construct a key using the indicated private key.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `final boolean`
  `equals(Object o)`
  The equals method for all Key objects will return the same result as the equality operator '=='.
  `final int`
  `hashCode()`
  The hash code for all Key objects will be the same as the system identity code of the object as defined by the System.identityHashCode() method.
  `protected final int`
  `intKey()`
  Returns the private integer key that the subclass instantiated this Key with.
  `abstract boolean`
  `isCompatibleValue(Object val)`
  Returns true if the specified object is a valid value for this Key.

  ### Methods declared in class Object

  `clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait`
  Modifier and Type
  Method
  Description
  `protected Object`
  `clone()`
  Creates and returns a copy of this object.
  `protected void`
  `finalize()`
  Deprecated, for removal: This API element is subject to removal in a future version.
  Finalization is deprecated and subject to removal in a future release.
  `final Class<?>`
  `getClass()`
  Returns the runtime class of this `Object`.
  `final void`
  `notify()`
  Wakes up a single thread that is waiting on this object's monitor.
  `final void`
  `notifyAll()`
  Wakes up all threads that are waiting on this object's monitor.
  `String`
  `toString()`
  Returns a string representation of the object.
  `final void`
  `wait()`
  Causes the current thread to wait until it is awakened, typically by being notified or interrupted.
  `final void`
  `wait(long timeoutMillis)`
  Causes the current thread to wait until it is awakened, typically by being notified or interrupted, or until a certain amount of real time has elapsed.
  `final void`
  `wait(long timeoutMillis, int nanos)`
  Causes the current thread to wait until it is awakened, typically by being notified or interrupted, or until a certain amount of real time has elapsed.

- ## Constructor Details

  - ### Key

    protected Key(int privatekey)
    Construct a key using the indicated private key. Each subclass of Key maintains its own unique domain of integer keys. No two objects with the same integer key and of the same specific subclass can be constructed. An exception will be thrown if an attempt is made to construct another object of a given class with the same integer key as a pre-existing instance of that subclass of Key.
    Parameters:
      `privatekey` - the specified key

- ## Method Details

  - ### isCompatibleValue

    public abstract boolean isCompatibleValue(Object val)
    Returns true if the specified object is a valid value for this Key.
    Parameters:
      `val` - the `Object` to test for validity
    Returns:
      `true` if `val` is valid; `false` otherwise.

  - ### intKey

    protected final int intKey()
    Returns the private integer key that the subclass instantiated this Key with.
    Returns:
      the private integer key that the subclass instantiated this Key with.

  - ### hashCode

    public final int hashCode()
    The hash code for all Key objects will be the same as the system identity code of the object as defined by the System.identityHashCode() method.
    Overrides:
      `hashCode` in class `Object`
    Returns:
      a hash code value for this object
    See Also:
      - `Object.equals(java.lang.Object)`
      - `System.identityHashCode(Object)`

  - ### equals

    public final boolean equals(Object o)
    The equals method for all Key objects will return the same result as the equality operator '=='.
    Overrides:
      `equals` in class `Object`
    Parameters:
      `o` - the reference object with which to compare.
    Returns:
      `true` if this object is the same as the obj argument; `false` otherwise.
    See Also:
      - `Object.hashCode()`
      - `HashMap`