aboutsummaryrefslogtreecommitdiffstats
path: root/main/src/cgeo/geocaching/utils/RxUtils.java
diff options
context:
space:
mode:
Diffstat (limited to 'main/src/cgeo/geocaching/utils/RxUtils.java')
-rw-r--r--main/src/cgeo/geocaching/utils/RxUtils.java11
1 files changed, 11 insertions, 0 deletions
diff --git a/main/src/cgeo/geocaching/utils/RxUtils.java b/main/src/cgeo/geocaching/utils/RxUtils.java
index deba573..a5cdc5f 100644
--- a/main/src/cgeo/geocaching/utils/RxUtils.java
+++ b/main/src/cgeo/geocaching/utils/RxUtils.java
@@ -1,6 +1,8 @@
package cgeo.geocaching.utils;
+import rx.Observable;
import rx.Scheduler;
+import rx.observables.BlockingObservable;
import rx.schedulers.Schedulers;
public class RxUtils {
@@ -9,4 +11,13 @@ public class RxUtils {
private RxUtils() {}
public final static Scheduler computationScheduler = Schedulers.computation();
+
+ public static <T> void waitForCompletion(final BlockingObservable<T> observable) {
+ observable.lastOrDefault(null);
+ return;
+ }
+
+ public static void waitForCompletion(final Observable<?>... observables) {
+ waitForCompletion(Observable.merge(observables).toBlockingObservable());
+ }
}