Package ste.lloop
Class ReturnValue
java.lang.Object
java.lang.Throwable
java.lang.Exception
java.lang.RuntimeException
ste.lloop.ReturnValue
- All Implemented Interfaces:
Serializable
A holder for a return value that can be used in a lambda expression.
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionConstructs a newReturnValueinstance with a null value.ReturnValue(Object value) Constructs a newReturnValueinstance with the given value. -
Method Summary
Methods inherited from class java.lang.Throwable
addSuppressed, getCause, getLocalizedMessage, getMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace
-
Constructor Details
-
ReturnValue
Constructs a newReturnValueinstance with the given value.- Parameters:
value- the initial value
-
ReturnValue
public ReturnValue()Constructs a newReturnValueinstance with a null value.
-
-
Method Details
-
value
public <R> R value()Returns the stored value, cast to a generic typeR.- Type Parameters:
R- the type to cast the value to- Returns:
- the stored value
-
fillInStackTrace
Overridden to avoid to create a stack trace, which is an expensive and resource intensive operation.- Overrides:
fillInStackTracein classThrowable- Returns:
- this
-
toString
-