Package w.util.lazy

Class SimpleLazy<T>

java.lang.Object
w.util.lazy.SimpleLazy<T>
All Implemented Interfaces:
Supplier<T>, Lazy<T>

public final class SimpleLazy<T> extends Object implements Lazy<T>
Простейшая реализация Lazy.

Если Supplier.get() выполняется в разных потоках, то следует использовать ConcurrentLazy.

Author:
whilein
  • Constructor Details

    • SimpleLazy

      public SimpleLazy()
  • Method Details

    • create

      @NotNull public static <T> @NotNull Lazy<T> create(@NotNull @NotNull Supplier<T> supplier)
    • clear

      public void clear()
      Description copied from interface: Lazy
      Очистить сохраненное значение
      Specified by:
      clear in interface Lazy<T>
    • clearAndGet

      public T clearAndGet()
      Description copied from interface: Lazy
      Очистить и получить новое значение
      Specified by:
      clearAndGet in interface Lazy<T>
      Returns:
      новое значение
    • get

      public T get()
      Specified by:
      get in interface Supplier<T>