Skip to content

Instantly share code, notes, and snippets.

@DominikMostek
Created July 27, 2015 09:35
Show Gist options
  • Save DominikMostek/c5ef8fe00cedb81743cf to your computer and use it in GitHub Desktop.
Save DominikMostek/c5ef8fe00cedb81743cf to your computer and use it in GitHub Desktop.
public static <T> Observable<T> takeWhileInclusive(Observable<T> source, Func1<T, Boolean> predicate) {
return source
.publish(selector ->
selector.takeWhile(predicate).concatWith(source.skipWhile(predicate).take(1)));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment