@CompileStatic abstract class GrailsArrayUtils extends Object
Utility methods for working with Arrays
Constructor and description |
---|
GrailsArrayUtils() |
Type Params | Return Type | Name and description |
---|---|---|
|
static Object |
add(Object array, int pos, Object newObject) Adds the given object to the given array at the given position |
|
static Object |
addAll(Object array, Object otherArray) Adds the given object to the given array at the given position |
|
static Object |
addToEnd(Object array, Object newObject) Adds the given object to the end of the array returning a new array |
|
static Object |
addToStart(Object array, Object newObject) Adds the given object to the start of the array returning a new array |
|
static boolean |
contains(Object[] array, Object elementToSearchFor) |
|
static Object |
subarray(Object args, int start, int end) Returns the subarray of an existing array |
|
static String |
toString(Object[] array) |
|
static String |
toString(int[] array) |
|
static String |
toString(boolean[] array) |
|
static String |
toString(float[] array) |
|
static String |
toString(short[] array) |
|
static String |
toString(byte[] array) |
|
static String |
toString(char[] array) |
Adds the given object to the given array at the given position
array
- The arraypos
- The positionnewObject
- The objectAdds the given object to the given array at the given position
array
- The arraypos
- The positionnewObject
- The objectAdds the given object to the end of the array returning a new array
array
- The arraynewObject
- The objectAdds the given object to the start of the array returning a new array
array
- The arraynewObject
- The objectReturns the subarray of an existing array
args
- The array objectstart
- The start index (inclusive)end
- The end index (exclusive)