Creates a ListenableFuture which has its value set immediately upon construction. The getters just return the value. This Future can't be canceled or timed out and its isDone() method always returns true.
(@Nullable V value)
| 139 | |
| 140 | |
| 141 | public static <V> ListenableFuture<V> immediateFuture(@Nullable V value) { |
| 142 | if (value == null) { |
| 143 | // This cast is safe because null is assignable to V for all V (i.e. it is covariant) |
| 144 | @SuppressWarnings({"unchecked", "rawtypes"}) |
| 145 | ListenableFuture<V> typedNull = (ListenableFuture) ImmediateSuccessfulFuture.NULL; |
| 146 | return typedNull; |
| 147 | } |
| 148 | return new ImmediateSuccessfulFuture<V>(value); |
| 149 | } |
| 150 | |
| 151 | /** |
| 152 | * Returns a {@code CheckedFuture} which has its value set immediately upon construction. |
no outgoing calls
no test coverage detected