Class Lazy<V>

java.lang.Object
org.ehrbase.util.Lazy<V>
Type Parameters:
V -
All Implemented Interfaces:
Supplier<V>

public final class Lazy<V> extends Object implements Supplier<V>
Lazy property value that can be used to cache values with "expensive" calculations during first time of access.
Usage:
 
     import static org.ehrbase.util.Lazy.lazy;

     class MyClass {

         private final Supplier<String> lazyValue = lazy(() -> "some expensive calculated value");

         public String getValue() {
             return lazyValue.get();
         }
     }
 
 
  • Constructor Details

  • Method Details