Package com.google.common.collect
Class ObjectArrays
- java.lang.Object
- 
- com.google.common.collect.ObjectArrays
 
- 
 @GwtCompatible(emulated=true) public final class ObjectArrays extends java.lang.Object Static utility methods pertaining to object arrays.- Since:
- 2.0
- Author:
- Kevin Bourrillion
 
- 
- 
Method SummaryAll Methods Static Methods Concrete Methods Modifier and Type Method Description static <T extends @Nullable java.lang.Object>
 T[]concat(T[] array, T element)Returns a new array that appendselementtoarray.static <T extends @Nullable java.lang.Object>
 T[]concat(T[] first, T[] second, java.lang.Class<@NonNull T> type)Returns a new array that contains the concatenated contents of two arrays.static <T extends @Nullable java.lang.Object>
 T[]concat(T element, T[] array)Returns a new array that prependselementtoarray.static <T extends @Nullable java.lang.Object>
 T[]newArray(java.lang.Class<@NonNull T> type, int length)Returns a new array of the given length with the specified component type.static <T extends @Nullable java.lang.Object>
 T[]newArray(T[] reference, int length)Returns a new array of the given length with the same type as a reference array.
 
- 
- 
- 
Method Detail- 
newArray@GwtIncompatible public static <T extends @Nullable java.lang.Object> T[] newArray(java.lang.Class<@NonNull T> type, int length) Returns a new array of the given length with the specified component type.- Parameters:
- type- the component type
- length- the length of the new array
 
 - 
newArraypublic static <T extends @Nullable java.lang.Object> T[] newArray(T[] reference, int length) Returns a new array of the given length with the same type as a reference array.- Parameters:
- reference- any array of the desired type
- length- the length of the new array
 
 - 
concat@GwtIncompatible public static <T extends @Nullable java.lang.Object> T[] concat(T[] first, T[] second, java.lang.Class<@NonNull T> type) Returns a new array that contains the concatenated contents of two 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 array
 
 - 
concatpublic static <T extends @Nullable java.lang.Object> T[] concat(T element, T[] array) Returns a new array that prependselementtoarray.- Parameters:
- element- the element to prepend to the front of- array
- array- the array of elements to append
- Returns:
- an array whose size is one larger than array, withelementoccupying the first position, and the elements ofarrayoccupying the remaining elements.
 
 - 
concatpublic static <T extends @Nullable java.lang.Object> T[] concat(T[] array, T element) Returns a new array that appendselementtoarray.- Parameters:
- array- the array of elements to prepend
- element- the element to append to the end
- Returns:
- an array whose size is one larger than array, with the same contents asarray, pluselementoccupying the last position.
 
 
- 
 
-