Skip to content

Instantly share code, notes, and snippets.

@frhack
Created June 2, 2015 12:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save frhack/7819a6a4fad065851d0c to your computer and use it in GitHub Desktop.
Save frhack/7819a6a4fad065851d0c to your computer and use it in GitHub Desktop.
Groovy break and continue in closures
/*
With rx-java you can transform an iterable in to an observable.
Then you can replace continue with a filter and break with takeWhile
Here is an example:
*/
import rx.Observable
Observable.from(1..100000000000000000)
.filter { it % 2 != 1}
.takeWhile { it<10 }
.forEach {println it}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment