package de.czyrux.store.util;

import io.reactivex.ObservableTransformer;
import io.reactivex.android.schedulers.AndroidSchedulers;
import io.reactivex.functions.Consumer;
import io.reactivex.internal.functions.Functions;
import io.reactivex.observers.DisposableObserver;
import io.reactivex.schedulers.Schedulers;

/**
 * Utility methods for RxJava 2
 */
public class RxUtil {

    private static final DisposableObserver EMPTY_OBSERVER = new DisposableObserver() {

        @Override
        public void onError(Throwable e) {
        }

        @Override
        public void onComplete() {

        }

        @Override
        public void onNext(Object o) {
        }
    };


    private RxUtil() {
    }

    @SuppressWarnings("unchecked")
    public static <T> DisposableObserver<T> emptyObserver() {
        return EMPTY_OBSERVER;
    }

    public static Consumer<? super Throwable> emptyConsumer() {
        return Functions.emptyConsumer();
    }

    public static <T> ObservableTransformer<T, T> applyStandardSchedulers() {
        return observable -> observable.subscribeOn(Schedulers.io())
                .observeOn(AndroidSchedulers.mainThread());
    }
}

@@ -371,16 +371,20 @@
 xUtil %7B%0A
+    
 %0A    pri
@@ -392,20 +392,82 @@
 ate 
+RxUtil() %7B%0A    %7D%0A%0A    @SuppressWarnings(%22unchecked%22)%0A    public 
 static 
-final
+%3CT%3E
  Dis
@@ -485,25 +485,44 @@
 rver
- EMPTY_OBSERVER =
+%3CT%3E emptyObserver() %7B%0A        return
  new
@@ -546,32 +546,36 @@
 er() %7B%0A%0A        
+   
+ 
 @Override%0A      
@@ -560,32 +560,36 @@
       @Override%0A
+    
         public v
@@ -611,24 +611,28 @@
 owable e) %7B%0A
+    
         %7D%0A%0A 
@@ -630,32 +630,36 @@
      %7D%0A%0A        
+    
 @Override%0A      
@@ -644,32 +644,36 @@
       @Override%0A
+    
         public v
@@ -692,35 +692,43 @@
 te() %7B%0A%0A        
+  
+  
 %7D%0A%0A
+    
         @Overrid
@@ -729,32 +729,36 @@
 verride%0A        
+   
+ 
 public void onNe
@@ -784,175 +784,23 @@
     
-%7D%0A
     %7D
-;%0A%0A
 %0A    
-private RxUtil() %7B%0A    %7D%0A%0A    @SuppressWarnings(%22unchecked%22)%0A    public static %3CT%3E DisposableObserver%3CT%3E emptyObserver() %7B%0A        return EMPTY_OBSERVER
+    %7D
 ;%0A  

Create empty observer to avoid “disposable already set” exception