These are chat archives for ReactiveX/RxJava

5th
Dec 2016
huirong628
@huirong628
Dec 05 2016 12:24
hello,everyone
Wolfhard Prell
@Cir0X
Dec 05 2016 14:11

Hey! Are there some operators with which I can achieve something described in the following?

For example I have a inheritance heriachy like: Condition as parent and ConditionA, ConditionB, ConditionC are children of Condition.
Than I have a Method which looks like this:

public Observable<Condition> getCondition() {...}

which returns indefinitely Condition's.

The goal would be a chaining an operator which caches the Condition's and when there is one available of each (ConditionA, ConditionB, ConditionC),
it should should filter them as described in the filter.
Maybe something like this:

getCondition()
    .cacheFilter<ConditionA, ConditionB, ConditionC>((a, b, c) -> a.value == 0 && b.value == 0 && c.value == 0)
        .do(somethingA())
    .cacheFilter<ConditionA, ConditionB, ConditionC>((a, b, c) -> a.value == 0 && b.value == 1 && c.value == 1)
        .do(somethingB())
    .cacheFilter<ConditionA, ConditionB, ConditionC>((a, b, c) -> a.value == 1 && b.value == 0 && c.value == 0)
        .do(somethingB())
    .subscribe();