Class Lazy<T>

java.lang.Object
dev.latvian.mods.klib.util.Lazy<T>
All Implemented Interfaces:
Supplier<T>

public class Lazy<T> extends Object implements Supplier<T>
  • Method Details

    • of

      public static <T> Lazy<T> of(Supplier<T> supplier)
    • of

      public static <T> Lazy<T> of(Supplier<T> supplier, Duration expires)
    • serviceLoader

      public static <T> Lazy<T> serviceLoader(Class<T> type)
    • map

      public static <K, V> Lazy<Map<K,V>> map(Consumer<Map<K,V>> supplier)
    • identityMap

      public static <K, V> Lazy<Map<K,V>> identityMap(Consumer<Map<K,V>> supplier)
    • streamCodec

      public static <B, V> net.minecraft.network.codec.StreamCodec<B,V> streamCodec(Supplier<net.minecraft.network.codec.StreamCodec<B,V>> supplier)
    • isCached

      public boolean isCached()
    • get

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

      public void forget()
    • forget

      public void forget(@Nullable @Nullable Consumer<T> ifCached)
    • map

      public <A> Lazy<A> map(Function<T,A> mapper)