Class Normalizer<T>

java.lang.Object
org.microbean.assign.Normalizer<T>
Type Parameters:
T - the type of object to be normalized

public final class Normalizer<T> extends Object
An experimental, simple, mutable, concurrent cache of objects.
Author:
Laird Nelson
See Also:
  • Constructor Details

  • Method Details

    • normalize

      public final T normalize(T element)
      Normalizes the supplied element such that if this Normalizer already has an equivalent cached element, the cached element is returned, and, if it does not, the supplied element is cached indefinitely and returned.
      Parameters:
      element - the element to normalize; may be null in which case null is returned
      Returns:
      the supplied element or a previously cached equivalent element
      See Also:
    • normalize

      public final T normalize(T element, Object extra)
      Normalizes the supplied element such that if this Normalizer already has an equivalent cached element, the cached element is returned, and, if it does not, the supplied element is cached indefinitely and returned.
      Parameters:
      element - the element to normalize; may be null in which case null is returned
      extra - additional data to include in equality comparisons; may be null; ignored if element is null
      Returns:
      the supplied element or a previously cached equivalent element