Polishing.

delegate.getResultWindow() the first time it's called in this method already produces a limit-sized result set, captured in resultsToUse. Running it through the same getResultWindow a second time in unnecessary.

Original Pull Request: #3021
This commit is contained in:
Yanming Zhou
2023-06-13 16:49:06 +08:00
committed by Greg L. Turnquist
parent 32f876ee07
commit cd1587ba1b

View File

@@ -35,6 +35,7 @@ import org.springframework.util.Assert;
* Delegate to run {@link ScrollPosition scroll queries} and create result {@link Window}.
*
* @author Mark Paluch
* @author Yanming Zhou
* @since 3.1
*/
public class ScrollDelegate<T> {
@@ -90,7 +91,7 @@ public class ScrollDelegate<T> {
return ScrollPosition.of(keys, direction);
};
return Window.from(delegate.getResultWindow(resultsToUse, limit), positionFunction, hasMoreElements(result, limit));
return Window.from(resultsToUse, positionFunction, hasMoreElements(result, limit));
}
private static <T> Window<T> createWindow(List<T> result, int limit,