Skip to content

Instantly share code, notes, and snippets.

@CoderJava
Created October 2, 2018 00:24
Show Gist options
  • Select an option

  • Save CoderJava/de3998cc2befdee9ed3b5e6d2b8279f8 to your computer and use it in GitHub Desktop.

Select an option

Save CoderJava/de3998cc2befdee9ed3b5e6d2b8279f8 to your computer and use it in GitHub Desktop.
Transforming Operator scan RxJava
public class RxTransformingOperatorScan {
public static void main(String[] args) {
Observable.just(1, 2, 3, 4, 5)
.scan((resultObserverPrevious, item) -> {
System.out.println("x: " + resultObserverPrevious + " & y: " + item);
return resultObserverPrevious + item;
})
.subscribe(System.out::println);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment