- java.lang.Object
-
- de.carne.util.Lazy<T>
-
- Type Parameters:
T- the actual object type.
- All Implemented Interfaces:
java.util.function.Supplier<T>
public class Lazy<@NonNull T> extends java.lang.Object implements java.util.function.Supplier<T>Utility class used to handle lazy initialized objects in anull-safe way.
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Tget()Get the object.java.util.Optional<T>getOptional()Gets the object as an Optional.java.lang.StringtoString()
-
-
-
Method Detail
-
get
public T get()
Get the object.The actual object will be created lazily the first time this function is invoked.
- Specified by:
getin interfacejava.util.function.Supplier<T>- Returns:
- The object.
-
getOptional
public java.util.Optional<T> getOptional()
Gets the object as an Optional.- Returns:
- the object as an Optional.
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
-