T
- the type of objects being suppliedpublic class CachingSupplier<T> extends Object implements Supplier<T>
get()
.
This can be used to delay computation intensive operations up until they are needed and also prevent from re-running a computation if the result is required several times.
Constructor and Description |
---|
CachingSupplier(Supplier<T> supplier)
Creates a new instance with the operation to delay.
|
Modifier and Type | Method and Description |
---|---|
T |
get()
Invokes the given supplier and returns the cached result for every other call.
|
Copyright © 2018. All rights reserved.