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
	}
});
This entry was posted in Java, RxJava. Bookmark the permalink. Post a comment or leave a trackback: Trackback URL.

Post a Comment

Your email is never published nor shared. Required fields are marked *

*
*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre lang="" line="" escaped="">