// Path: awex-core/src/main/java/com/raycoarana/awex/callbacks/CancelCallback.java
// public interface CancelCallback {
// 
//     void onCancel();
// 
// }
// 
// Path: awex-core/src/main/java/com/raycoarana/awex/callbacks/DoneCallback.java
// public interface DoneCallback<T> {
// 
//     void onDone(T result);
// 
// }
// 
// Path: awex-core/src/main/java/com/raycoarana/awex/callbacks/FailCallback.java
// public interface FailCallback {
// 
//     void onFail(Exception exception);
// 
// }
// 
// Path: awex-core/src/main/java/com/raycoarana/awex/transform/Filter.java
// public interface Filter<T> {
//     boolean filter(T value);
// }
// 
// Path: awex-core/src/main/java/com/raycoarana/awex/transform/Func.java
// public interface Func<T> {
//     void run(T item);
// }
// 
// Path: awex-core/src/main/java/com/raycoarana/awex/transform/Mapper.java
// public interface Mapper<T, U> {
//     U map(T value);
// }


import com.raycoarana.awex.callbacks.CancelCallback;
import com.raycoarana.awex.callbacks.DoneCallback;
import com.raycoarana.awex.callbacks.FailCallback;
import com.raycoarana.awex.transform.Filter;
import com.raycoarana.awex.transform.Func;
import com.raycoarana.awex.transform.Mapper;
import java.util.Collection;
import java.util.Collections;
    public <U> AwexCollectionPromise(Awex mAwex, Promise<U, Progress> promise) {
        super(mAwex);

        promise.done(new DoneCallback<U>() {
            @SuppressWarnings("unchecked")
            @Override
            public void onDone(U result) {
                Collection<Result> collectionResult;
                if (result instanceof Collection) {
                    collectionResult = (Collection<Result>) result;
                } else {
                    collectionResult = (Collection<Result>) Collections.singleton(result);
                }
                AwexCollectionPromise.this.resolve(collectionResult);
            }
        }).fail(new FailCallback() {
            @Override
            public void onFail(Exception exception) {
                AwexCollectionPromise.this.reject(exception);
            }
        }).cancel(new CancelCallback() {
            @Override
            public void onCancel() {
                AwexCollectionPromise.this.cancelTask();
            }
        });
    }

    @SuppressWarnings("unchecked")
    @Override
// Path: awex-core/src/main/java/com/raycoarana/awex/callbacks/CancelCallback.java
// public interface CancelCallback {
// 
//     void onCancel();
// 
// }
// 
// Path: awex-core/src/main/java/com/raycoarana/awex/callbacks/DoneCallback.java
// public interface DoneCallback<T> {
// 
//     void onDone(T result);
// 
// }
// 
// Path: awex-core/src/main/java/com/raycoarana/awex/callbacks/FailCallback.java
// public interface FailCallback {
// 
//     void onFail(Exception exception);
// 
// }
// 
// Path: awex-core/src/main/java/com/raycoarana/awex/transform/Filter.java
// public interface Filter<T> {
//     boolean filter(T value);
// }
// 
// Path: awex-core/src/main/java/com/raycoarana/awex/transform/Func.java
// public interface Func<T> {
//     void run(T item);
// }
// 
// Path: awex-core/src/main/java/com/raycoarana/awex/transform/Mapper.java
// public interface Mapper<T, U> {
//     U map(T value);
// }


// Path: awex-core/src/main/java/com/raycoarana/awex/AwexCollectionPromise.java
import com.raycoarana.awex.callbacks.CancelCallback;
import com.raycoarana.awex.callbacks.DoneCallback;
import com.raycoarana.awex.callbacks.FailCallback;
import com.raycoarana.awex.transform.Filter;
import com.raycoarana.awex.transform.Func;
import com.raycoarana.awex.transform.Mapper;
import java.util.Collection;
import java.util.Collections;

    public <U> AwexCollectionPromise(Awex mAwex, Promise<U, Progress> promise) {
        super(mAwex);

        promise.done(new DoneCallback<U>() {
            @SuppressWarnings("unchecked")
            @Override
            public void onDone(U result) {
                Collection<Result> collectionResult;
                if (result instanceof Collection) {
                    collectionResult = (Collection<Result>) result;
                } else {
                    collectionResult = (Collection<Result>) Collections.singleton(result);
                }
                AwexCollectionPromise.this.resolve(collectionResult);
            }
        }).fail(new FailCallback() {
            @Override
            public void onFail(Exception exception) {
                AwexCollectionPromise.this.reject(exception);
            }
        }).cancel(new CancelCallback() {
            @Override
            public void onCancel() {
                AwexCollectionPromise.this.cancelTask();
            }
        });
    }

    @SuppressWarnings("unchecked")
    @Override
    public CollectionPromise<Result, Progress> stream() {