T
- the type held by the array to be converted@ThreadSafe public final class ArrayTool<T> extends Object
Expect this to be very slow, uses LOAD of reflection to simplify array tasks at the cost of performance
Modifier and Type | Method and Description |
---|---|
T[] |
cloneArray(com.google.common.base.Function<T,T> cloner)
Creates a deep copy of an array, assuming that its
Object.clone() method returns a deep copy |
<C> C[] |
convertTo(Class<C> c)
Converts the underlying array to an array of the type specified
|
T[] |
underlyingArray()
Gets the array of this tool
|
static <T> ArrayTool<T> |
using(T[] array)
Creates a new array tool
|
public static <T> ArrayTool<T> using(T[] array)
T
- the type of the arrayarray
- the underlying arraypublic <C> C[] convertTo(Class<C> c)
C
- the array typec
- the classtype for the new arrayClassCastException
- if the type of the underlying array cannot be cast to the new typepublic T[] cloneArray(com.google.common.base.Function<T,T> cloner)
Object.clone()
method returns a deep copypublic T[] underlyingArray()
Copyright © 2016. All rights reserved.