diff options
author | Per-Åke Minborg <minborg@speedment.com> | 2016-10-28 08:39:13 -0700 |
---|---|---|
committer | Henri Sara <hesara@vaadin.com> | 2016-11-02 15:21:30 +0000 |
commit | a17918fb4039897042b671e7b3525e7b17a63944 (patch) | |
tree | 30395dfbb1665ddc114e8512ae845a5174f068e9 /server | |
parent | 26557c4fca92ace4a7a35b7f055777a442632fc2 (diff) | |
download | vaadin-framework-a17918fb4039897042b671e7b3525e7b17a63944.tar.gz vaadin-framework-a17918fb4039897042b671e7b3525e7b17a63944.zip |
Remove manual array copy
Change-Id: I80b73b653e97904605dc62484a7448f3bfbf721b
Diffstat (limited to 'server')
5 files changed, 10 insertions, 16 deletions
diff --git a/server/src/main/java/com/vaadin/data/BeanBinder.java b/server/src/main/java/com/vaadin/data/BeanBinder.java index b05e24fc9c..a2307a5161 100644 --- a/server/src/main/java/com/vaadin/data/BeanBinder.java +++ b/server/src/main/java/com/vaadin/data/BeanBinder.java @@ -40,6 +40,7 @@ import com.vaadin.server.SerializableBiConsumer; import com.vaadin.server.SerializableFunction; import com.vaadin.server.SerializablePredicate; import com.vaadin.util.ReflectTools; +import java.util.Arrays; /** * A {@code Binder} subclass specialized for binding <em>beans</em>: classes @@ -480,9 +481,7 @@ public class BeanBinder<BEAN> extends Binder<BEAN> { ArrayList<Field> memberFieldInOrder = new ArrayList<>(); while (searchClass != null) { - for (Field memberField : searchClass.getDeclaredFields()) { - memberFieldInOrder.add(memberField); - } + memberFieldInOrder.addAll(Arrays.asList(searchClass.getDeclaredFields())); searchClass = searchClass.getSuperclass(); } return memberFieldInOrder; diff --git a/server/src/main/java/com/vaadin/event/ActionManager.java b/server/src/main/java/com/vaadin/event/ActionManager.java index b221d17511..5d9a92e000 100644 --- a/server/src/main/java/com/vaadin/event/ActionManager.java +++ b/server/src/main/java/com/vaadin/event/ActionManager.java @@ -26,6 +26,7 @@ import com.vaadin.server.PaintException; import com.vaadin.server.PaintTarget; import com.vaadin.server.VariableOwner; import com.vaadin.ui.Component; +import java.util.Arrays; /** * Javadoc TODO @@ -249,9 +250,7 @@ public class ActionManager for (Action.Handler h : actionHandlers) { Action[] as = h.getActions(target, sender); if (as != null) { - for (Action a : as) { - actions.add(a); - } + actions.addAll(Arrays.asList(as)); } } } diff --git a/server/src/main/java/com/vaadin/event/ListenerMethod.java b/server/src/main/java/com/vaadin/event/ListenerMethod.java index b81ebd28bc..bf80f1e74b 100644 --- a/server/src/main/java/com/vaadin/event/ListenerMethod.java +++ b/server/src/main/java/com/vaadin/event/ListenerMethod.java @@ -508,9 +508,7 @@ public class ListenerMethod implements EventListener, Serializable { method.invoke(target, new Object[] { event }); } else { final Object[] arg = new Object[arguments.length]; - for (int i = 0; i < arg.length; i++) { - arg[i] = arguments[i]; - } + System.arraycopy(arguments, 0, arg, 0, arg.length); arg[eventArgumentIndex] = event; method.invoke(target, arg); } diff --git a/server/src/main/java/com/vaadin/ui/declarative/FieldBinder.java b/server/src/main/java/com/vaadin/ui/declarative/FieldBinder.java index 29c4c5491d..a4a4f0ffdf 100644 --- a/server/src/main/java/com/vaadin/ui/declarative/FieldBinder.java +++ b/server/src/main/java/com/vaadin/ui/declarative/FieldBinder.java @@ -27,6 +27,7 @@ import java.util.Map; import java.util.logging.Logger; import com.vaadin.ui.Component; +import java.util.Arrays; /** * Binder utility that binds member fields of a design class instance to given @@ -249,10 +250,8 @@ public class FieldBinder implements Serializable { Class<?> searchClass) { ArrayList<java.lang.reflect.Field> memberFields = new ArrayList<>(); - for (java.lang.reflect.Field memberField : searchClass - .getDeclaredFields()) { - memberFields.add(memberField); - } + memberFields.addAll(Arrays.asList(searchClass + .getDeclaredFields())); return memberFields; } diff --git a/server/src/test/java/com/vaadin/tests/server/ClassesSerializableTest.java b/server/src/test/java/com/vaadin/tests/server/ClassesSerializableTest.java index 1d30e41382..865856f79c 100644 --- a/server/src/test/java/com/vaadin/tests/server/ClassesSerializableTest.java +++ b/server/src/test/java/com/vaadin/tests/server/ClassesSerializableTest.java @@ -30,6 +30,7 @@ import org.junit.Assert; import org.junit.Test; import com.vaadin.ui.Component; +import java.util.Arrays; public class ClassesSerializableTest { @@ -269,9 +270,7 @@ public class ClassesSerializableTest { } String[] split = classpath.split(pathSep); - for (String classpathEntry : split) { - locations.add(classpathEntry); - } + locations.addAll(Arrays.asList(split)); return locations; } |