Top Description Constructors Methods
org.eclipse.jetty.util

public Class ArrayUtil

extends Object
Class Inheritance
Imports
java.lang.reflect.Array, java.util.ArrayList, .Arrays, .List

Utility methods for Array manipulation

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
public static <
the array entry type
T
>
T[]

Returns:

new array with contents of both arrays, or null if both arrays are null
add
(T[]
An array to add to (or null)
array1
,
T[]
An array to add to (or null)
array2
)

Add arrays

public static <
the array entry type
T
>
T[]

Returns:

new array with contents of array plus item
addToArray
(T[]
The array to add to (or null)
array
,
T
The item to add
item
,
Class<?>
The type of the array (in case of null array)
type
)

Add element to an array

public static <
the array entry type
E
>
List<E>

Returns:

A new modifiable list initialised with the elements from array.
asMutableList
(E[]
Any array of object
array
)

public static <
the array entry type
T
>
T[]

Returns:

new array with contents of array plus item
prependToArray
(T
The item to add
item
,
T[]
The array to add to (or null)
array
,
Class<?>
The type of the array (in case of null array)
type
)

Add element to the start of an array

public static <T> T[]
removeFromArray(T[] array, Object item)

public static <T> T[]
removeNulls(T[] array)

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Constructor Detail

ArrayUtilback to summary
private ArrayUtil()

Method Detail

addback to summary
public static <T> T[] add(T[] array1, T[] array2)

Add arrays

Parameters
<T>
the array entry type
array1:T[]

An array to add to (or null)

array2:T[]

An array to add to (or null)

Returns:T[]

new array with contents of both arrays, or null if both arrays are null

addToArrayback to summary
public static <T> T[] addToArray(T[] array, T item, Class<?> type)

Add element to an array

Parameters
<T>
the array entry type
array:T[]

The array to add to (or null)

item:T

The item to add

type:Class<?>

The type of the array (in case of null array)

Returns:T[]

new array with contents of array plus item

asMutableListback to summary
public static <E> List<E> asMutableList(E[] array)
Parameters
<E>
the array entry type
array:E[]

Any array of object

Returns:List<E>

A new modifiable list initialised with the elements from array.

prependToArrayback to summary
public static <T> T[] prependToArray(T item, T[] array, Class<?> type)

Add element to the start of an array

Parameters
<T>
the array entry type
item:T

The item to add

array:T[]

The array to add to (or null)

type:Class<?>

The type of the array (in case of null array)

Returns:T[]

new array with contents of array plus item

removeFromArrayback to summary
public static <T> T[] removeFromArray(T[] array, Object item)
removeNullsback to summary
public static <T> T[] removeNulls(T[] array)