// Path: src/main/java/org/dataloader/impl/Assertions.java
// public static void assertState(boolean state, Supplier<String> message) {
//     if (!state) {
//         throw new DataLoaderAssertionException(message.get());
//     }
// }
// 
// Path: src/main/java/org/dataloader/impl/Assertions.java
// public static <T> T nonNull(T t) {
//     return nonNull(t, () -> "nonNull object required");
// }


import org.dataloader.annotations.Internal;
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.CompletionException;
import java.util.concurrent.CompletionStage;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.atomic.AtomicReference;
import java.util.function.Consumer;
import java.util.stream.Collectors;
import static org.dataloader.impl.Assertions.assertState;
import static org.dataloader.impl.Assertions.nonNull;
package org.dataloader.impl;




@Internal
public class PromisedValuesImpl<T> implements PromisedValues<T> {

    private final List<? extends CompletionStage<T>> futures;
    private final CompletionStage<Void> controller;
    private final AtomicReference<Throwable> cause;

    private PromisedValuesImpl(List<? extends CompletionStage<T>> cs) {
// Path: src/main/java/org/dataloader/impl/Assertions.java
// public static void assertState(boolean state, Supplier<String> message) {
//     if (!state) {
//         throw new DataLoaderAssertionException(message.get());
//     }
// }
// 
// Path: src/main/java/org/dataloader/impl/Assertions.java
// public static <T> T nonNull(T t) {
//     return nonNull(t, () -> "nonNull object required");
// }


// Path: src/main/java/org/dataloader/impl/PromisedValuesImpl.java
import org.dataloader.annotations.Internal;
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.CompletionException;
import java.util.concurrent.CompletionStage;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.atomic.AtomicReference;
import java.util.function.Consumer;
import java.util.stream.Collectors;
import static org.dataloader.impl.Assertions.assertState;
import static org.dataloader.impl.Assertions.nonNull;

package org.dataloader.impl;




@Internal
public class PromisedValuesImpl<T> implements PromisedValues<T> {

    private final List<? extends CompletionStage<T>> futures;
    private final CompletionStage<Void> controller;
    private final AtomicReference<Throwable> cause;

    private PromisedValuesImpl(List<? extends CompletionStage<T>> cs) {
        this.futures = nonNull(cs);