MCPcopy Create free account
hub / github.com/antlr/codebuff / immediateFuture

Method immediateFuture

output/java_guava/1.4.17/Futures.java:141–149  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

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.

Callers 4

reloadMethod · 0.95
loadFutureMethod · 0.95
reloadMethod · 0.95
loadFutureMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected