T
- type of supplied value@NotThreadSafe
public static class StreamUtils.LazySupplier<T>
extends java.lang.Object
implements java.util.function.Supplier<T>
Example:
LazySupplier<InputStream> supplier = LazySupplier.of(() -> { return new FileInputStream(file); }); ... if (supplier.supplied()) { IOUtils.closeQuietly(inputStreamSupplier.get()); }
Modifier and Type | Field and Description |
---|---|
protected java.util.function.Supplier<T> |
supplier |
protected T |
value |
Constructor and Description |
---|
LazySupplier(java.util.function.Supplier<T> supplier) |
Modifier and Type | Method and Description |
---|---|
T |
get() |
static <T> StreamUtils.LazySupplier<T> |
of(java.util.function.Supplier<T> supplier) |
boolean |
supplied() |
protected T value
protected final java.util.function.Supplier<T> supplier
public LazySupplier(java.util.function.Supplier<T> supplier)
public static <T> StreamUtils.LazySupplier<T> of(java.util.function.Supplier<T> supplier)
public boolean supplied()
get()
invocation