Interview questions
Question 166 of 254
FreeWhat are Mono and Flux, and what is the difference between them?
Reactive Programming (WebFlux)
Mono<T> and Flux<T> are Project Reactor's two core reactive publisher types. Mono represents a stream that emits at most one element (or completes empty, or errors) — analogous to an async single value or Optional. Flux represents a stream that can emit zero, one, or many elements over time before completing (or erroring) — analogous to an async, potentially infinite List/Stream. Both are lazy: nothing happens until something subscribes to them.
Intermediate5 min

