Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import io.reactivex.Observable;
- import io.reactivex.observables.GroupedObservable;
- import java.util.concurrent.CountDownLatch;
- import java.util.concurrent.TimeUnit;
- public class TypeTest {
- public static void main(String[] args) throws Exception {
- CountDownLatch latch = new CountDownLatch(1);
- Observable<Long> source Observable.interval(1,TimeUnit.MILLISECONDS).take(20);
- Observable<GroupedObservable<String,Long>> sgb =
- source.groupBy(x-> (x%2==0)?"Even":"Odd");
- // I'd like to introduce a variable for source.reduce but I get a type error.
- // Observable<Long> sreduce = source.reduce(new Long(0),(x,y)->(x+y));
- source.reduce(new Long(0),(x,y)->(x+y)).subscribe(
- x->{System.out.println(x);latch.countDown();}
- );
- latch.await();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement