Class LazyThrowingSingleton<T, X extends Exception>
java.lang.Object
uk.co.parnmatt.vector.util.LazyThrowingSingleton<T,X>
- Type Parameters:
T- the type of the singleton valueX- the exception that can be thrown during the evaluation of the singleton
- All Implemented Interfaces:
ThrowingSupplier<T,X>
public final class LazyThrowingSingleton<T, X extends Exception>
extends Object
implements ThrowingSupplier<T,X>
Represents a singleton that is lazily evaluated on the first call to
get()-
Constructor Details
-
LazyThrowingSingleton
- Parameters:
supplier- the supplier to provide the value of the singleton
-
-
Method Details
-
get
-
getIfPresentOrNull
- Returns:
- the singleton if it has been initialized, otherwise
null
-
isInitialized
public boolean isInitialized()- Returns:
trueif the singleton has been initialized, otherwisefalse
-
toString
-