3 ms·
You could accomplish the same thing with a public static Object[] createArray(Object... objects) { ... } but doing it statically, hard-coded like this is f
by nysauhem 16y ago
You could accomplish the same thing with a
public static Object[] createArray(Object... objects) {
...
}
but doing it statically, hard-coded like this is faster. You leave it to the compiler to determine the length of the arguments, rather than having to count them at run-time.
The Google Guava library does something similar, but not to this extent, only up to 12 args
http://guava-libraries.googlecode.com/svn-history/r12/trunk/javadoc/com/google/common/collect/ImmutableList.html http://guava-libraries.googlecode.com/svn-history/r12/trunk/...