Java 类com.google.common.util.concurrent.ImmediateFuture.ImmediateSuccessfulFuture 实例源码

项目:guava-mock    文件:Futures.java   
/**
 * Creates a {@code ListenableFuture} which has its value set immediately upon construction. The
 * getters just return the value. This {@code Future} can't be canceled or timed out and its
 * {@code isDone()} method always returns {@code true}.
 */
public static <V> ListenableFuture<V> immediateFuture(@Nullable V value) {
  if (value == null) {
    // This cast is safe because null is assignable to V for all V (i.e. it is covariant)
    @SuppressWarnings({"unchecked", "rawtypes"})
    ListenableFuture<V> typedNull = (ListenableFuture) ImmediateSuccessfulFuture.NULL;
    return typedNull;
  }
  return new ImmediateSuccessfulFuture<V>(value);
}
项目:googles-monorepo-demo    文件:Futures.java   
/**
 * Creates a {@code ListenableFuture} which has its value set immediately upon construction. The
 * getters just return the value. This {@code Future} can't be canceled or timed out and its
 * {@code isDone()} method always returns {@code true}.
 */
public static <V> ListenableFuture<V> immediateFuture(@Nullable V value) {
  if (value == null) {
    // This cast is safe because null is assignable to V for all V (i.e. it is covariant)
    @SuppressWarnings({"unchecked", "rawtypes"})
    ListenableFuture<V> typedNull = (ListenableFuture) ImmediateSuccessfulFuture.NULL;
    return typedNull;
  }
  return new ImmediateSuccessfulFuture<V>(value);
}
项目:codebuff    文件:Futures.java   
/**
 * Creates a {@code ListenableFuture} which has its value set immediately upon construction. The
 * getters just return the value. This {@code Future} can't be canceled or timed out and its
 * {@code isDone()} method always returns {@code true}.
 */


public static <V> ListenableFuture<V> immediateFuture(@Nullable V value) {
  if (value == null) {
    // This cast is safe because null is assignable to V for all V (i.e. it is covariant)
    @SuppressWarnings({"unchecked", "rawtypes"})
    ListenableFuture<V> typedNull = (ListenableFuture) ImmediateSuccessfulFuture.NULL;
    return typedNull;
  }
  return new ImmediateSuccessfulFuture<V>(value);
}
项目:codebuff    文件:Futures.java   
/**
 * Creates a {@code ListenableFuture} which has its value set immediately upon construction. The
 * getters just return the value. This {@code Future} can't be canceled or timed out and its
 * {@code isDone()} method always returns {@code true}.
 */


public static <V> ListenableFuture<V> immediateFuture(@Nullable V value) {
  if (value == null) {
    // This cast is safe because null is assignable to V for all V (i.e. it is covariant)
    @SuppressWarnings({"unchecked", "rawtypes"})
    ListenableFuture<V> typedNull = (ListenableFuture) ImmediateSuccessfulFuture.NULL;
    return typedNull;
  }
  return new ImmediateSuccessfulFuture<V>(value);
}
项目:codebuff    文件:Futures.java   
/**
 * Creates a {@code ListenableFuture} which has its value set immediately upon construction. The
 * getters just return the value. This {@code Future} can't be canceled or timed out and its
 * {@code isDone()} method always returns {@code true}.
 */


public static <V> ListenableFuture<V> immediateFuture(@Nullable V value) {
  if (value == null) {
    // This cast is safe because null is assignable to V for all V (i.e. it is covariant)
    @SuppressWarnings({"unchecked", "rawtypes"})
    ListenableFuture<V> typedNull = (ListenableFuture) ImmediateSuccessfulFuture.NULL;
    return typedNull;
  }
  return new ImmediateSuccessfulFuture<V>(value);
}
项目:codebuff    文件:Futures.java   
/**
 * Creates a {@code ListenableFuture} which has its value set immediately upon construction. The
 * getters just return the value. This {@code Future} can't be canceled or timed out and its
 * {@code isDone()} method always returns {@code true}.
 */


public static <V> ListenableFuture<V> immediateFuture(@Nullable V value) {
  if (value == null) {
    // This cast is safe because null is assignable to V for all V (i.e. it is covariant)
    @SuppressWarnings({"unchecked", "rawtypes"})
    ListenableFuture<V> typedNull = (ListenableFuture) ImmediateSuccessfulFuture.NULL;
    return typedNull;
  }
  return new ImmediateSuccessfulFuture<V>(value);
}
项目:codebuff    文件:Futures.java   
/**
 * Creates a {@code ListenableFuture} which has its value set immediately upon construction. The
 * getters just return the value. This {@code Future} can't be canceled or timed out and its
 * {@code isDone()} method always returns {@code true}.
 */
public static <V> ListenableFuture<V> immediateFuture(@Nullable V value) {
  if (value == null) {
    // This cast is safe because null is assignable to V for all V (i.e. it is covariant)
    @SuppressWarnings({"unchecked", "rawtypes"})
    ListenableFuture<V> typedNull = (ListenableFuture) ImmediateSuccessfulFuture.NULL;
    return typedNull;
  }
  return new ImmediateSuccessfulFuture<V>(value);
}
项目:guava    文件:Futures.java   
/**
 * Creates a {@code ListenableFuture} which has its value set immediately upon construction. The
 * getters just return the value. This {@code Future} can't be canceled or timed out and its
 * {@code isDone()} method always returns {@code true}.
 */
public static <V> ListenableFuture<V> immediateFuture(@NullableDecl V value) {
  if (value == null) {
    // This cast is safe because null is assignable to V for all V (i.e. it is covariant)
    @SuppressWarnings({"unchecked", "rawtypes"})
    ListenableFuture<V> typedNull = (ListenableFuture) ImmediateSuccessfulFuture.NULL;
    return typedNull;
  }
  return new ImmediateSuccessfulFuture<V>(value);
}
项目:guava    文件:Futures.java   
/**
 * Creates a {@code ListenableFuture} which has its value set immediately upon construction. The
 * getters just return the value. This {@code Future} can't be canceled or timed out and its
 * {@code isDone()} method always returns {@code true}.
 */
public static <V> ListenableFuture<V> immediateFuture(@NullableDecl V value) {
  if (value == null) {
    // This cast is safe because null is assignable to V for all V (i.e. it is covariant)
    @SuppressWarnings({"unchecked", "rawtypes"})
    ListenableFuture<V> typedNull = (ListenableFuture) ImmediateSuccessfulFuture.NULL;
    return typedNull;
  }
  return new ImmediateSuccessfulFuture<V>(value);
}