// Path: domain/src/main/java/com/mike/feed/domain/interactor/UseCase.java
// public abstract class UseCase {
// 
//   private final ThreadExecutor threadExecutor;
//   private final PostExecutionThread postExecutionThread;
// 
//   private Subscription subscription = Subscriptions.empty();
// 
//   protected UseCase(ThreadExecutor threadExecutor,
//       PostExecutionThread postExecutionThread) {
//     this.threadExecutor = threadExecutor;
//     this.postExecutionThread = postExecutionThread;
//   }
// 
//   /**
//    * Builds an {@link Observable} which will be used when executing the current {@link UseCase}.
//    */
//   protected abstract Observable buildUseCaseObservable();
// 
//   /**
//    * Executes the current use case.
//    *
//    * @param useCaseSubscriber The guy who will be listen to the observable build
//    * with {@link #buildUseCaseObservable()}.
//    */
//   @SuppressWarnings("unchecked")
//   public void execute(Subscriber useCaseSubscriber) {
//     this.subscription = this.buildUseCaseObservable()
//         .subscribeOn(Schedulers.from(threadExecutor))
//         .observeOn(postExecutionThread.getScheduler())
//         .subscribe(useCaseSubscriber);
//   }
// 
//   public boolean isUnsubscribed(){
//     return subscription.isUnsubscribed();
//   }
// 
//   /**
//    * Unsubscribes from current {@link Subscription}.
//    */
//   public void unsubscribe() {
//     if (!subscription.isUnsubscribed()) {
//       subscription.unsubscribe();
//     }
//   }
// }


import com.mike.feed.domain.interactor.UseCase;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import rx.Subscription;
import rx.exceptions.Exceptions;
                    }
                    subscriptions.add(s);
                    return;
                }
            }
        }
        // call after leaving the synchronized block so we're not holding a lock while executing this
        s.unsubscribe();
    }


    public void remove(final Subscription s) {
        if (!unsubscribed) {
            boolean unsubscribe = false;
            synchronized (this) {
                if (unsubscribed || subscriptions == null) {
                    return;
                }
                unsubscribe = subscriptions.remove(s);
            }
            if (unsubscribe) {
                // if we removed successfully we then need to call unsubscribe on it (outside of the lock)
                s.unsubscribe();
            }
        }
    }


    public void clear() {
        if (!unsubscribed) {
// Path: domain/src/main/java/com/mike/feed/domain/interactor/UseCase.java
// public abstract class UseCase {
// 
//   private final ThreadExecutor threadExecutor;
//   private final PostExecutionThread postExecutionThread;
// 
//   private Subscription subscription = Subscriptions.empty();
// 
//   protected UseCase(ThreadExecutor threadExecutor,
//       PostExecutionThread postExecutionThread) {
//     this.threadExecutor = threadExecutor;
//     this.postExecutionThread = postExecutionThread;
//   }
// 
//   /**
//    * Builds an {@link Observable} which will be used when executing the current {@link UseCase}.
//    */
//   protected abstract Observable buildUseCaseObservable();
// 
//   /**
//    * Executes the current use case.
//    *
//    * @param useCaseSubscriber The guy who will be listen to the observable build
//    * with {@link #buildUseCaseObservable()}.
//    */
//   @SuppressWarnings("unchecked")
//   public void execute(Subscriber useCaseSubscriber) {
//     this.subscription = this.buildUseCaseObservable()
//         .subscribeOn(Schedulers.from(threadExecutor))
//         .observeOn(postExecutionThread.getScheduler())
//         .subscribe(useCaseSubscriber);
//   }
// 
//   public boolean isUnsubscribed(){
//     return subscription.isUnsubscribed();
//   }
// 
//   /**
//    * Unsubscribes from current {@link Subscription}.
//    */
//   public void unsubscribe() {
//     if (!subscription.isUnsubscribed()) {
//       subscription.unsubscribe();
//     }
//   }
// }


// Path: mvvm/src/main/java/com/mike/feed/util/CompositeUseCases.java
import com.mike.feed.domain.interactor.UseCase;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import rx.Subscription;
import rx.exceptions.Exceptions;

                    }
                    subscriptions.add(s);
                    return;
                }
            }
        }
        // call after leaving the synchronized block so we're not holding a lock while executing this
        s.unsubscribe();
    }


    public void remove(final Subscription s) {
        if (!unsubscribed) {
            boolean unsubscribe = false;
            synchronized (this) {
                if (unsubscribed || subscriptions == null) {
                    return;
                }
                unsubscribe = subscriptions.remove(s);
            }
            if (unsubscribe) {
                // if we removed successfully we then need to call unsubscribe on it (outside of the lock)
                s.unsubscribe();
            }
        }
    }


    public void clear() {
        if (!unsubscribed) {
            Collection<UseCase> unsubscribe = null;