Filtering lets selected values continue while leaving others out. In Project Reactor, `filter()` takes a `Predicate`: a test applied to each value from a source `Flux`. The resulting `Flux` emits only values that pass. section 11.3.3
Keep names without spaces
Start with `Flux.just("Yellowstone", "Yosemite", "Grand Canyon", "Zion", "Grand Teton")`, then call `.filter(name -> !name.contains(" "))`. The resulting Flux emits `Yellowstone`, `Yosemite`, and `Zion`; the two names containing spaces do not pass the predicate. A `StepVerifier` test can check those three values and completion. section 11.3.3
Choose the operator that matches the rule. `filter()` handles a general predicate; `distinct()` removes values already emitted. `skip()` and `take()` can also serve as filters when the rule depends on an item count or a duration. section 11.3.3
A Spring Integration filter serves a related purpose in a different kind of flow: it allows or disallows whole messages before the next step. For an integer message, an `@Filter` method returning `number % 2 == 0` can pass even numbers from an input channel to an output channel. In a Java DSL integration flow, `.filter((p) -> p % 2 == 0)` expresses the same rule; more involved rules can use a `GenericSelector` instead of a lambda. section 10.2 section 10.2.2
































