com.google.common.collect
Class ObjectArrays

java.lang.Object
  extended by com.google.common.collect.ObjectArrays

public final class ObjectArrays
extends Object

Static utility methods pertaining to object arrays.

Author:
Kevin Bourrillion

Method Summary
static
<T> T[]
concat(T[] first, T[] second, Class<T> type)
          Returns a new array of a specified type, containing the concatenated contents of the two given arrays.
static
<T> T[]
emptyArray(T[] array)
          Returns an empty (immutable) array with the same component type as the specified array.
static
<T> T[]
newArray(Class<T> type, int length)
          Returns a new array with the specified component type and length.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

newArray

public static <T> T[] newArray(Class<T> type,
                               int length)
Returns a new array with the specified component type and length.

Parameters:
type - the component type
length - the length of the new array

emptyArray

public static <T> T[] emptyArray(T[] array)
Returns an empty (immutable) array with the same component type as the specified array.

Parameters:
array - the array from which to infer the component type

concat

public static <T> T[] concat(T[] first,
                             T[] second,
                             Class<T> type)
Returns a new array of a specified type, containing the concatenated contents of the two given arrays.

Parameters:
first - the first array of elements to concatenate
second - the second array of elements to concatenate
type - the component type of the returned concatenated array