接口 Lazy<T>

  • 类型参数:
    T - the value type
    所有超级接口:
    java.util.function.Supplier<T>

    public interface Lazy<T>
    extends java.util.function.Supplier<T>
    Supplier that only compute value only once.

    If error occurred when compute value, the exception would be thrown, and the next call will run the code again. If computed value is null, a NPE would be thrown.

    • 方法概要

      所有方法 静态方法 实例方法 抽象方法 
      修饰符和类型 方法 说明
      T get()  
      <R> Lazy<R> map​(java.util.function.Function<? super T,​? extends R> function)
      Create a new lazy value, with value is calculated using function
      static <T> Lazy<T> of​(java.util.function.Supplier<T> supplier)
      Create one new Lazy instance.
    • 方法详细资料

      • of

        static <T> Lazy<T> of​(java.util.function.Supplier<T> supplier)
        Create one new Lazy instance.
        类型参数:
        T - the value type
        参数:
        supplier - provider the value
        返回:
        the created lazy value
      • get

        T get()
        指定者:
        get 在接口中 java.util.function.Supplier<T>
      • map

        <R> Lazy<R> map​(java.util.function.Function<? super T,​? extends R> function)
        Create a new lazy value, with value is calculated using function
        类型参数:
        R - new value type
        参数:
        function - the function to calculate value
        返回:
        the new lazy value