Hacker News new | ask | show | jobs
by nysauhem 5681 days 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/...