Skip to content

Instantly share code, notes, and snippets.

@rabestro
Last active September 9, 2023 08:07
Show Gist options
  • Save rabestro/886e92d3d8ce805d1427300c0a77c0ee to your computer and use it in GitHub Desktop.
Save rabestro/886e92d3d8ce805d1427300c0a77c0ee to your computer and use it in GitHub Desktop.
FizzBuzz Filter
IntStream ints = rangeClosed(1, 20);
IntPredicate fizz = i->i%3==0;
IntPredicate buzz = i->i%5==0;
IntPredicate fizzBuzz =...
assertThat(ints.filter(fizzBuzz))
.containsExactly(4,7,8,9,13,14,19);
@rabestro
Copy link
Author

rabestro commented Sep 9, 2023

Define a predicate to filter all numbers between fizz and buzz predicates (exclusive).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment