How to use "if-else" in RX java chain? : <p>I am a newer on RXJava/RXAndroid. I want to implement this case: chose different way based on some condition in RXJava. 
For example, first, I fetch user info from network and if this is a VIP user, I will go on to fetch more info from network or just show some info in main thread (break the chain.)   Here the flow chart: <a href="https://i.stack.imgur.com/0hztR.png" rel="noreferrer">https://i.stack.imgur.com/0hztR.png</a></p>

<p>I do some search on this and only find "switchIfEmpty" may help.
I write the following code:</p>

<pre><code>getUserFromNetwork("userId")
                .flatMap(new Function&lt;User, ObservableSource&lt;User&gt;&gt;() {
                    @Override
                    public ObservableSource&lt;User&gt; apply(User user) throws Exception {
                        if(!user.isVip){
                            //show user info on MainThread!
                            return Observable.empty();
                        }else{
                            return getVipUserFromNetwork("userId");
                        }
                    }
                }).switchIfEmpty(new ObservableSource&lt;User&gt;() {
                    @Override
                    public void subscribe(Observer&lt;? super User&gt; observer) {
                        //show user info in main thread
                        //just break the chain for normal user
                        observer.onComplete();
                    }
                }).doOnNext(new Consumer&lt;User&gt;() {
                    @Override
                    public void accept(User user) throws Exception {
                        //show vip user info in main thread
                    }
                }).subscribe();
</code></pre>

<p>Is there more simple way to achieve this?</p>

<p>Thanks!</p>
