Returns a new CompletionStage that is already completed with the given value and supports only
those methods in interface {@link CompletionStage}.

@param value the value
@param <U> the type of the value
@return the completed CompletionStage
@since 9
345783
public static <U> CompletionStage<U> completedStage(U value) {
    return new MinimalStage<U>((value == null) ? NIL : value);
  }
399247
public void addValue(String value)
    {
        if(this.values == null)
            this.values = new ArrayList<String>();
        this.values.add(value);
    }
135695
public Object setValue(final Object value) {
        final Object answer = this.value;
        this.value = value;
        return answer;
    }
1037744
public T put(final T value) {
		expungeStaleEntries();
		//
		final int hash = value.hashCode();
		int index = (hash & 0x7FFFFFFF) % elementData.length;
		Entry<T> entry = elementData[index];
		while (entry != null && !eq(value, entry.get())) {
			entry = entry.nextInSlot;
		}

		if (entry == null) {
			if (++elementCount > threshold) {
				expandElementArray(elementData.length);
				index = (hash & 0x7FFFFFFF) % elementData.length;
			}
			entry = createHashedEntry(value, index);
			return null;
		}

		final T result = entry.get();
		return result;
	}
778841
public static Object delayedValue(CompletionStage<Void> stage, Object syncValue, Throwable throwable) {
      if (throwable == null) {
         return delayedValue(stage, syncValue);
      }
      if (stage != null) {
         CompletableFuture<?> future = stage.toCompletableFuture();
         if (!future.isDone() || future.isCompletedExceptionally()) {
            return asyncValue(
                  stage.handle((ignore, t) -> {
                     if (t != null) {
                        throwable.addSuppressed(t);
                     }
                     return null;
                  }).thenCompose(ignore -> CompletableFutures.completedExceptionFuture(throwable))
            );
         }
      }
      return new SimpleAsyncInvocationStage(throwable);
   }
380106
public static <T extends Annotation> T create(Class<T> annotationType, Object value) {
    return new Builder<T>(annotationType).withValue(value).create();
  }
1336881
public static PrimitiveEvent event(EventType eventType, byte[] value) {
    return new PrimitiveEvent(EventType.canonical(eventType), value);
  }
910400
public static <T> T eq(T value) {
        reportMatcher(new Equals(value));
        if (value == null)
            return null;
        return (T) Primitives.defaultValue(value.getClass());
    }
1054758
@Override
    public ElementOperator<PlainTime> newValue(V value) {

        return new TimeOperator(this, ElementOperator.OP_NEW_VALUE, value);

    }
362450
public JSONStringer value(boolean value) throws JSONException {
		if (this.stack.isEmpty()) {
			throw new JSONException("Nesting problem");
		}
		beforeValue();
		this.out.append(value);
		return this;
	}
364034
public static <T> JsonObjectBase buildSimpleObjectSuccess(T value) {

        JsonSimpleObject json = new JsonSimpleObject();
        json.setResult(value);

        LOG.info(json.toString());

        return json;
    }
1139904
private JsonElement toElement(final Object value) {

		if (value != null) {

			if (value instanceof String) {

				return new JsonPrimitive((String)value);

			} else if (value instanceof Number) {

				return new JsonPrimitive((Number)value);

			} else if (value instanceof Boolean) {

				return new JsonPrimitive((Boolean)value);

			} else if (value.getClass().isArray()) {

				final JsonArray arr   = new JsonArray();
				final Object[] values = (Object[])value;

				for (final Object v : values) {
					arr.add(toElement(v));
				}

				return arr;

			} else {

				return new JsonPrimitive(value.toString());
			}
		}

		return JsonNull.INSTANCE;
	}
1231735
public static <V extends Value> ValueList<V> getInstance(V... value) {
        ValueList<V> result = new ValueList<>(value.length);
        for (V val : value) {
            result.add(val);
        }
        return result;
    }
83986
public static CompletionException asCompletionException( Throwable error )
    {
        if ( error instanceof CompletionException )
        {
            return ((CompletionException) error);
        }
        return new CompletionException( error );
    }
1178928
public void addValue(
                    final Object value
                    )
    {
        if (value == null) {
            setNullContained( true );
        } else {
            _values.add( String.valueOf( value ) );
        }
    }
584480
private <R, U> CompletionStage<U> doApplyToEitherAsync(
            CompletionStage<? extends R> first,
            CompletionStage<? extends R> second,
            Function<? super R, U> fn,
            Executor executor) {
    	CompletableCompletionStage<R> nextStage = newCompletableCompletionStage();

        // only the first result is accepted by completion stage,
        // the other one is ignored
        BiConsumer<R, Throwable> action = completeHandler(nextStage);
        first.whenComplete(action);
        second.whenComplete(action);

        return nextStage.thenApplyAsync(fn, executor);
    }
1039574
public boolean complete(Number value) {
		return root.complete(new Tree((Tree) null, null, value));
	}