aboutsummaryrefslogtreecommitdiffstats
path: root/server/src/main/java/com/vaadin/data/provider/BackEndDataProvider.java
diff options
context:
space:
mode:
authorAleksi Hietanen <aleksi@vaadin.com>2017-01-04 11:22:13 +0200
committerGitHub <noreply@github.com>2017-01-04 11:22:13 +0200
commit7b9c6bd5d13cf9c004d1cb2d544683ed3e7b17e5 (patch)
tree8d7d717286f4f4eec4ea17b3082a7c647f116ca9 /server/src/main/java/com/vaadin/data/provider/BackEndDataProvider.java
parent451161461bf240e4fd25211ed997d96e565a211b (diff)
downloadvaadin-framework-7b9c6bd5d13cf9c004d1cb2d544683ed3e7b17e5.tar.gz
vaadin-framework-7b9c6bd5d13cf9c004d1cb2d544683ed3e7b17e5.zip
Avoid redundant autoboxing in BackEndDataProvider's size callback (#8127)
Diffstat (limited to 'server/src/main/java/com/vaadin/data/provider/BackEndDataProvider.java')
-rw-r--r--server/src/main/java/com/vaadin/data/provider/BackEndDataProvider.java7
1 files changed, 4 insertions, 3 deletions
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<T, F> extends AbstractDataProvider<T, F> {
private final SerializableFunction<Query<T, F>, Stream<T>> request;
- private final SerializableFunction<Query<T, F>, Integer> sizeCallback;
+ private final SerializableToIntFunction<Query<T, F>> sizeCallback;
/**
* Constructs a new DataProvider to request data from an arbitrary back end
@@ -47,7 +48,7 @@ public class BackEndDataProvider<T, F> extends AbstractDataProvider<T, F> {
*/
public BackEndDataProvider(
SerializableFunction<Query<T, F>, Stream<T>> request,
- SerializableFunction<Query<T, F>, Integer> sizeCallback) {
+ SerializableToIntFunction<Query<T, F>> 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<T, F> extends AbstractDataProvider<T, F> {
@Override
public int size(Query<T, F> query) {
- return sizeCallback.apply(query);
+ return sizeCallback.applyAsInt(query);
}
/**