From cd1587ba1bd901e3dd11d28dde837fcc2956da40 Mon Sep 17 00:00:00 2001 From: Yanming Zhou Date: Tue, 13 Jun 2023 16:49:06 +0800 Subject: [PATCH] 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 --- .../data/jpa/repository/query/ScrollDelegate.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/spring-data-jpa/src/main/java/org/springframework/data/jpa/repository/query/ScrollDelegate.java b/spring-data-jpa/src/main/java/org/springframework/data/jpa/repository/query/ScrollDelegate.java index eb244a020..b3e7ad5d2 100644 --- a/spring-data-jpa/src/main/java/org/springframework/data/jpa/repository/query/ScrollDelegate.java +++ b/spring-data-jpa/src/main/java/org/springframework/data/jpa/repository/query/ScrollDelegate.java @@ -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 { @@ -90,7 +91,7 @@ public class ScrollDelegate { 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 Window createWindow(List result, int limit,