GrailsArrayUtils (Grails 2.3.8)
Date: 2014-04-24

Overview | Package | Class | Deprecated | Index | Help
| Groovy Documentation
| FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.codehaus.groovy.grails.commons
[Groovy] Class GrailsArrayUtils

    java.lang.Object
      org.codehaus.groovy.grails.commons.GrailsArrayUtils

    @groovy.transform.CompileStatic
    abstract class GrailsArrayUtils
    extends java.lang.Object

Utility methods for working with Arrays

Since:
  2.3.6

Method Summary
`static java.lang.Object` | `add(java.lang.Object array, int pos, java.lang.Object newObject)` Adds the given object to the given array at the given position
`static java.lang.Object` | `addAll(java.lang.Object array, java.lang.Object otherArray)` Adds the given object to the given array at the given position
`static java.lang.Object` | `addToEnd(java.lang.Object array, java.lang.Object newObject)` Adds the given object to the end of the array returning a new array
`static java.lang.Object` | `addToStart(java.lang.Object array, java.lang.Object newObject)` Adds the given object to the start of the array returning a new array
`static java.lang.Object` | `subarray(java.lang.Object args, int start, int end)` Returns the subarray of an existing array
`static java.lang.String` | `toString(java.lang.Object... array)`
`static java.lang.String` | `toString(int... array)`
`static java.lang.String` | `toString(boolean... array)`
`static java.lang.String` | `toString(float... array)`
`static java.lang.String` | `toString(short... array)`
`static java.lang.String` | `toString(byte... array)`
`static java.lang.String` | `toString(char... array)`

Methods inherited from class java.lang.Object
java.lang.Object#wait(long, int), java.lang.Object#wait(long), java.lang.Object#wait(), java.lang.Object#equals(java.lang.Object), java.lang.Object#toString(), java.lang.Object#hashCode(), java.lang.Object#getClass(), java.lang.Object#notify(), java.lang.Object#notifyAll()

Method Detail

### add

    static java.lang.Object add(java.lang.Object array, int pos, java.lang.Object newObject)

  Adds the given object to the given array at the given position
  Parameters:
    `array` - The array
    `pos` - The position
    `newObject` - The object
  Returns:
    A new array, one element bigger, with the object added at the given position

### addAll

    static java.lang.Object addAll(java.lang.Object array, java.lang.Object otherArray)

  Adds the given object to the given array at the given position
  Parameters:
    `array` - The array
    `pos` - The position
    `newObject` - The object
  Returns:
    A new array, one element bigger, with the object added at the given position

### addToEnd

    static java.lang.Object addToEnd(java.lang.Object array, java.lang.Object newObject)

  Adds the given object to the end of the array returning a new array
  Parameters:
    `array` - The array
    `newObject` - The object
  Returns:
    A new array with the given object added to the end

### addToStart

    static java.lang.Object addToStart(java.lang.Object array, java.lang.Object newObject)

  Adds the given object to the start of the array returning a new array
  Parameters:
    `array` - The array
    `newObject` - The object
  Returns:
    A new array with the given object added to the start

### subarray

    static java.lang.Object subarray(java.lang.Object args, int start, int end)

  Returns the subarray of an existing array
  Parameters:
    `args` - The array object
    `start` - The start index (inclusive)
    `end` - The end index (exclusive)
  Returns:
    The new array

### toString

    static java.lang.String toString(java.lang.Object... array)

### toString

    static java.lang.String toString(int... array)

### toString

    static java.lang.String toString(boolean... array)

### toString

    static java.lang.String toString(float... array)

### toString

    static java.lang.String toString(short... array)

### toString

    static java.lang.String toString(byte... array)

### toString

    static java.lang.String toString(char... array)

Groovy Documentation