public static < T > Optional < T > tryGetFutureValue ( Future < T > future ) { requireNonNull ( future , "future is null" ) ; if ( ! future . isDone ( ) ) { return Optional . empty ( ) ; } return tryGetFutureValue ( future , 0 , MILLISECONDS ) ; }
Gets the current value of the future without waiting . If the future value is null an empty Optional is still returned and in this case the caller must check the future directly for the null value .