// Path: app/src/main/java/com/lucilu/rxdynamicsearch/rx/utils/ObservableEx.java
// public final class ObservableEx {
// 
//     private ObservableEx() {
//     }
// 
//     /**
//      * Filters NONE {@link Option} items that are converted by selector.
//      *
//      * @param observable to be filtered
//      * @param selector   to convert value to {@link Option}
//      * @return Filtered observable
//      */
//     @NonNull
//     public static <IN, OUT> Observable<OUT> choose(@NonNull final Observable<IN> observable,
//                                                    @NonNull final Func1<IN, Option<OUT>> selector) {
//         return observable.map(selector)
//                          .filter(Option::isSome)
//                          .map(OptionUnsafe::getUnsafe);
//     }
// 
//     /**
//      * Filters NONE {@link Option} items that are converted by selector.
//      *
//      * @param observable to be filtered
//      * @return Filtered observable
//      */
//     @NonNull
//     public static <T> Observable<T> choose(@NonNull final Observable<Option<T>> observable) {
//         return choose(observable, it -> it);
//     }
// }


import com.lucilu.rxdynamicsearch.rx.utils.ObservableEx;
import polanski.option.Option;
import rx.Observable;
package com.lucilu.rxdynamicsearch.rx.transformer;



/**
 * Filters out all Option of NONE if any, but if Some, then unwraps and returns the
 * value.
 */
public final class ChooseTransformer<T>
        implements Observable.Transformer<Option<T>, T> {

    @Override
    public Observable<T> call(final Observable<Option<T>> optionObservable) {
// Path: app/src/main/java/com/lucilu/rxdynamicsearch/rx/utils/ObservableEx.java
// public final class ObservableEx {
// 
//     private ObservableEx() {
//     }
// 
//     /**
//      * Filters NONE {@link Option} items that are converted by selector.
//      *
//      * @param observable to be filtered
//      * @param selector   to convert value to {@link Option}
//      * @return Filtered observable
//      */
//     @NonNull
//     public static <IN, OUT> Observable<OUT> choose(@NonNull final Observable<IN> observable,
//                                                    @NonNull final Func1<IN, Option<OUT>> selector) {
//         return observable.map(selector)
//                          .filter(Option::isSome)
//                          .map(OptionUnsafe::getUnsafe);
//     }
// 
//     /**
//      * Filters NONE {@link Option} items that are converted by selector.
//      *
//      * @param observable to be filtered
//      * @return Filtered observable
//      */
//     @NonNull
//     public static <T> Observable<T> choose(@NonNull final Observable<Option<T>> observable) {
//         return choose(observable, it -> it);
//     }
// }


// Path: app/src/main/java/com/lucilu/rxdynamicsearch/rx/transformer/ChooseTransformer.java
import com.lucilu.rxdynamicsearch.rx.utils.ObservableEx;
import polanski.option.Option;
import rx.Observable;

package com.lucilu.rxdynamicsearch.rx.transformer;



/**
 * Filters out all Option of NONE if any, but if Some, then unwraps and returns the
 * value.
 */
public final class ChooseTransformer<T>
        implements Observable.Transformer<Option<T>, T> {

    @Override
    public Observable<T> call(final Observable<Option<T>> optionObservable) {
        return ObservableEx.choose(optionObservable);