Creates and answers an array containing the given items.
This is a more expressive, less repetitive way to create arrays. For example:
Integer[] littlePrimes = arrayWith( 2, 3, 5, 7 );
versus
Integer[] littlePrimes = new Integer[] { 2, 3, 5, 7 };
- Type Parameters:
E
- the type of the items- Parameters:
items
- a variable-length list of items
- Returns:
- the items as an array
- Throws:
NullPointerException
- if the varargs list is null
IllegalArgumentException
- if the varargs list is of length zero- See Also:
-
Java 5 syntax tricks to keep you DRY