RxJava .reduce()

Observable.from(new Integer[]{1,2,3,4,5})
.reduce(new Func2<Integer, Integer, Integer>() {			
	@Override
	public Integer call(Integer t1, Integer t2) {
		return t1+t2;
	}
}).subscribe(new Action1<Integer>() {
	@Override
	public void call(Integer t) {
                // t = 15
	}
});

Leave a Reply

Your email address will not be published. Required fields are marked *