You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@wicket.apache.org by GitBox <gi...@apache.org> on 2020/09/28 08:55:41 UTC

[GitHub] [wicket] theigl commented on a change in pull request #454: WICKET-6833 Reduce allocations for PageParameters.mergeWith

theigl commented on a change in pull request #454:
URL: https://github.com/apache/wicket/pull/454#discussion_r495786864



##########
File path: wicket-request/src/main/java/org/apache/wicket/request/mapper/parameter/PageParameters.java
##########
@@ -294,35 +293,48 @@ public PageParameters add(final String name, final Object value, final int index
 		Args.notEmpty(name, "name");
 		Args.notNull(value, "value");
 
-		if (namedParameters == null)
-		{
-			namedParameters = new ArrayList<>(1);
-		}
-
-		List<String> values = new ArrayList<>();
 		if (value instanceof String[])
 		{
-			values.addAll(Arrays.asList((String[])value));
+			addNamed(name, (String[]) value, index, type);
 		}
 		else
 		{
-			values.add(value.toString());
+			addNamed(name, value.toString(), index, type);
+		}
+
+		return this;
+	}
+
+	private void addNamed(String name, String[] values, int index, Type type) 
+	{
+		if (namedParameters == null)

Review comment:
       Done




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org