From 7b9c6bd5d13cf9c004d1cb2d544683ed3e7b17e5 Mon Sep 17 00:00:00 2001 From: Aleksi Hietanen Date: Wed, 4 Jan 2017 11:22:13 +0200 Subject: Avoid redundant autoboxing in BackEndDataProvider's size callback (#8127) --- .../main/java/com/vaadin/data/provider/BackEndDataProvider.java | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'server/src/main/java/com/vaadin/data') diff --git a/server/src/main/java/com/vaadin/data/provider/BackEndDataProvider.java b/server/src/main/java/com/vaadin/data/provider/BackEndDataProvider.java index 2ceebc995a..5f789e8a55 100644 --- a/server/src/main/java/com/vaadin/data/provider/BackEndDataProvider.java +++ b/server/src/main/java/com/vaadin/data/provider/BackEndDataProvider.java @@ -21,6 +21,7 @@ import java.util.Objects; import java.util.stream.Stream; import com.vaadin.server.SerializableFunction; +import com.vaadin.server.SerializableToIntFunction; import com.vaadin.shared.Registration; /** @@ -34,7 +35,7 @@ import com.vaadin.shared.Registration; public class BackEndDataProvider extends AbstractDataProvider { private final SerializableFunction, Stream> request; - private final SerializableFunction, Integer> sizeCallback; + private final SerializableToIntFunction> sizeCallback; /** * Constructs a new DataProvider to request data from an arbitrary back end @@ -47,7 +48,7 @@ public class BackEndDataProvider extends AbstractDataProvider { */ public BackEndDataProvider( SerializableFunction, Stream> request, - SerializableFunction, Integer> sizeCallback) { + SerializableToIntFunction> sizeCallback) { Objects.requireNonNull(request, "Request function can't be null"); Objects.requireNonNull(sizeCallback, "Size callback can't be null"); this.request = request; @@ -61,7 +62,7 @@ public class BackEndDataProvider extends AbstractDataProvider { @Override public int size(Query query) { - return sizeCallback.apply(query); + return sizeCallback.applyAsInt(query); } /** -- cgit v1.2.3