So my question is simple, I am getting a Slice<Object>
from database using pageable.
Then I need to filter it based on some parameters(fe. status), so as usual I'm doing something like this:
slice.getContent().stream().filter(o -> o.getStatus().equals(status)).collect(Collectors.toList())
But I still need to return the Slice<Object>
. How can I correctly convert the result of filtering into Slice<Object>
?
I know about the SliceImpl<>
, which requires 3 arguments List<T> content, Pageable pageable, boolean hasNext
but how do I correctly determine the pageable
and the hasNext
of my filtered list? Is there a quick and easy way that I don't know of?