Think about what happens in the non-reactive world: we could decide to make all the functions return List<T>
, even when we know they will only return a single element. Example:
public List<T> findAll() <-- looks ok
public List<T> findFirst() <-- seems strange?
public T findFirst() <-- better now?
So why don't we always return List<T>
? because it's more convenient that sometimes we use List<T>
and others simply T
, this way it is easier on the user of the function to understand what to expect.
Now if we convert these examples to the reactive world, we get this:
public List<T> findAll() --> public Flux<T> findAll()
public T findFirst() --> public Mono<T> findFirst()
Sure, we could always use Flux<T>
as we could always use List<T>
, but it is just more convenient to be able to differentiate when there multiple items or just one.