Here you can find the source of isSuccessful(CompletableFuture
Parameter | Description |
---|---|
f | The future to inspect. |
T | The Type of the future's result. |
public static <T> boolean isSuccessful(CompletableFuture<T> f)
//package com.java2s; /**/*from w w w . j a va 2 s . c om*/ * Copyright (c) 2017 Dell Inc., or its subsidiaries. All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 */ import java.util.concurrent.CompletableFuture; public class Main { /** * Returns true if the future is done and successful. * * @param f The future to inspect. * @param <T> The Type of the future's result. * @return True if the given CompletableFuture has completed successfully. */ public static <T> boolean isSuccessful(CompletableFuture<T> f) { return f.isDone() && !f.isCompletedExceptionally() && !f.isCancelled(); } }