SupplierUtil (Grails 6.0.0)

Package: grails.util

## [Java] Class SupplierUtil

- grails.util.SupplierUtil

-     public class SupplierUtil
      extends java.lang.Object

  Helper methods for dealing with java.util.function.Supplier.

  Authors:
    James Kleeh
  Since:
    1.0

- - ### Field Summary

    Fields
    Modifiers | Name | Description
    --- | --- | ---
    `java.util.function.Supplier<T>` | `delegate` |
    `java.util.function.Supplier<T>` | `delegate` |
    `boolean` | `initialized` |
    `boolean` | `initialized` |

  - ### Methods Summary

    Methods
    Type Params | Return Type | Name and description
    --- | --- | ---
    `` | `public T` | `get()`
    `` | `public T` | `get()`
    `` | `private T` | `initialize()`
    `` | `private T` | `initialize()`
    `<T>` | `public static java.util.function.Supplier<T>` | `memoized(java.util.function.Supplier<T> actual)` Caches the result of supplier in a thread safe manner.
    `<T>` | `public static java.util.function.Supplier<T>` | `memoizedNonEmpty(java.util.function.Supplier<T> actual)` Caches the result of supplier in a thread safe manner.

  - ### Inherited Methods Summary

    Inherited Methods
    Methods inherited from class | Name
    --- | ---
    `class java.lang.Object` | `java.lang.Object#wait(long), java.lang.Object#wait(long, int), java.lang.Object#wait(), java.lang.Object#equals(java.lang.Object), java.lang.Object#toString(), java.lang.Object#hashCode(), java.lang.Object#getClass(), java.lang.Object#notify(), java.lang.Object#notifyAll()`

- - ### Field Detail

    - #### java.util.function.Supplier<T> delegate

    - #### boolean initialized

  - ### Method Detail

    - #### public T get()

    - #### private T initialize()

    - #### <T> public static java.util.function.Supplier<T> memoized(java.util.function.Supplier<T> actual)

      Caches the result of supplier in a thread safe manner.

      Parameters:
        `actual` - The supplier providing the result
      Type Parameters:
        `T` - The type of result
      Returns:
        A new supplier that will cache the result

    - #### <T> public static java.util.function.Supplier<T> memoizedNonEmpty(java.util.function.Supplier<T> actual)

      Caches the result of supplier in a thread safe manner. The result is only cached if it is non null or non empty if an optional.

      Parameters:
        `actual` - The supplier providing the result
      Type Parameters:
        `T` - The type of result
      Returns:
        A new supplier that will cache the result