// Path: waterfallcache/src/main/java/com/github/simonpercic/waterfallcache/callback/WaterfallCallback.java
// public interface WaterfallCallback extends WaterfallFailureCallback {
// 
//     /**
//      * Called on success.
//      */
//     void onSuccess();
// }
// 
// Path: waterfallcache/src/main/java/com/github/simonpercic/waterfallcache/callback/WaterfallFailureCallback.java
// public interface WaterfallFailureCallback {
// 
//     /**
//      * Called on failure.
//      *
//      * @param throwable throwable
//      */
//     void onFailure(Throwable throwable);
// }
// 
// Path: waterfallcache/src/main/java/com/github/simonpercic/waterfallcache/callback/WaterfallGetCallback.java
// public interface WaterfallGetCallback<T> extends WaterfallFailureCallback {
// 
//     /**
//      * Called on success. Returns the value.
//      *
//      * @param object returned object
//      */
//     void onSuccess(T object);
// }


import com.github.simonpercic.waterfallcache.callback.WaterfallCallback;
import com.github.simonpercic.waterfallcache.callback.WaterfallFailureCallback;
import com.github.simonpercic.waterfallcache.callback.WaterfallGetCallback;
import rx.Observable;
import rx.functions.Action1;
package com.github.simonpercic.waterfallcache.utils;



/**
 * @author Simon Percic <a href="https://github.com/simonpercic">https://github.com/simonpercic</a>
 */
public final class AsyncUtils {

    private AsyncUtils() {
        //no instance
    }

    public static void doAsync(Observable<Boolean> observable, final WaterfallCallback callback) {
        observable.subscribe(success -> {
            if (callback != null) {
                callback.onSuccess();
            }
        }, asyncOnError(callback));
    }

// Path: waterfallcache/src/main/java/com/github/simonpercic/waterfallcache/callback/WaterfallCallback.java
// public interface WaterfallCallback extends WaterfallFailureCallback {
// 
//     /**
//      * Called on success.
//      */
//     void onSuccess();
// }
// 
// Path: waterfallcache/src/main/java/com/github/simonpercic/waterfallcache/callback/WaterfallFailureCallback.java
// public interface WaterfallFailureCallback {
// 
//     /**
//      * Called on failure.
//      *
//      * @param throwable throwable
//      */
//     void onFailure(Throwable throwable);
// }
// 
// Path: waterfallcache/src/main/java/com/github/simonpercic/waterfallcache/callback/WaterfallGetCallback.java
// public interface WaterfallGetCallback<T> extends WaterfallFailureCallback {
// 
//     /**
//      * Called on success. Returns the value.
//      *
//      * @param object returned object
//      */
//     void onSuccess(T object);
// }


// Path: waterfallcache/src/main/java/com/github/simonpercic/waterfallcache/utils/AsyncUtils.java
import com.github.simonpercic.waterfallcache.callback.WaterfallCallback;
import com.github.simonpercic.waterfallcache.callback.WaterfallFailureCallback;
import com.github.simonpercic.waterfallcache.callback.WaterfallGetCallback;
import rx.Observable;
import rx.functions.Action1;

package com.github.simonpercic.waterfallcache.utils;



/**
 * @author Simon Percic <a href="https://github.com/simonpercic">https://github.com/simonpercic</a>
 */
public final class AsyncUtils {

    private AsyncUtils() {
        //no instance
    }

    public static void doAsync(Observable<Boolean> observable, final WaterfallCallback callback) {
        observable.subscribe(success -> {
            if (callback != null) {
                callback.onSuccess();
            }
        }, asyncOnError(callback));
    }

    public static <T> void doAsync(Observable<T> observable, final WaterfallGetCallback<T> callback) {