From f5a6dc28f567e15999aec20a3ed4b67d3eae317c Mon Sep 17 00:00:00 2001 From: Henri Yandell Date: Sun, 3 Apr 2011 23:35:59 +0000 Subject: [PATCH] Setting the length of the new array to optimize speed git-svn-id: https://svn.apache.org/repos/asf/commons/proper/lang/trunk@1088439 13f79535-47bb-0310-9956-ffa450edef68 --- .../java/org/apache/commons/lang3/exception/ExceptionUtils.java | 2 +- src/main/java/org/apache/commons/lang3/reflect/TypeUtils.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/org/apache/commons/lang3/exception/ExceptionUtils.java b/src/main/java/org/apache/commons/lang3/exception/ExceptionUtils.java index a34165e4a..f93136bb3 100644 --- a/src/main/java/org/apache/commons/lang3/exception/ExceptionUtils.java +++ b/src/main/java/org/apache/commons/lang3/exception/ExceptionUtils.java @@ -551,7 +551,7 @@ public class ExceptionUtils { frames.add(trace.get(j)); } } - return frames.toArray(new String[0]); + return frames.toArray(new String[frames.size()]); } /** diff --git a/src/main/java/org/apache/commons/lang3/reflect/TypeUtils.java b/src/main/java/org/apache/commons/lang3/reflect/TypeUtils.java index bf2c968d9..826ccb5b7 100644 --- a/src/main/java/org/apache/commons/lang3/reflect/TypeUtils.java +++ b/src/main/java/org/apache/commons/lang3/reflect/TypeUtils.java @@ -886,7 +886,7 @@ public class TypeUtils { } } - return types.toArray(new Type[0]); + return types.toArray(new Type[types.size()]); } /**