Package org.springframework.data.domain
Class WindowIterator<T>
java.lang.Object
org.springframework.data.domain.WindowIterator<T>
- All Implemented Interfaces:
Iterator<T>
An
Iterator
over multiple Windows
obtained via a window function
, that keeps
track of the current ScrollPosition
allowing scrolling across all result elements.
WindowIterator<User> users = WindowIterator.of(position -> repository.findFirst10By…("spring", position)) .startingAt(OffsetScrollPosition.initial()); while (users.hasNext()) { User u = users.next(); // consume user }
- Since:
- 3.1
- Author:
- Christoph Strobl, Mark Paluch
-
Nested Class Summary
-
Method Summary
Modifier and TypeMethodDescriptionboolean
hasNext()
next()
static <T> WindowIterator.WindowIteratorBuilder<T>
of
(Function<ScrollPosition, Window<T>> windowFunction) Entrypoint to create a newWindowIterator
for the given windowFunction.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface java.util.Iterator
forEachRemaining, remove
-
Method Details
-
of
public static <T> WindowIterator.WindowIteratorBuilder<T> of(Function<ScrollPosition, Window<T>> windowFunction) Entrypoint to create a newWindowIterator
for the given windowFunction.- Type Parameters:
T
-- Parameters:
windowFunction
- must not be null.- Returns:
- new instance of
WindowIterator.WindowIteratorBuilder
.
-
hasNext
public boolean hasNext() -
next
-