Overview | Package | Class | Tree | Deprecated | Index | Help
| Groovy JDK

## java.lang
Class Object[]

Method Summary
`Object` | `asType(Class clazz)` Converts the given array to either a List, Set, or SortedSet call is deferred to {link #asType(Object,Class)}
`boolean` | `equals(List right)` Determines if the contents of this array are equal to the contents of the given list, in the same order `false` if either collection is `null`
`List` | `getAt(Collection indices)` Allows a List to be used as the indices to be used on a List
`List` | `getAt(Range range)` Support the range subscript operator for an Array
`List` | `getAt(IntRange range)`
`List` | `getAt(EmptyRange range)`
`List` | `getAt(ObjectRange range)`
`Object` | `getAt(int idx)` Support the subscript operator for an Array
`Object` | `inject(Object initialValue, Closure closure)` Iterates through the given array of objects, passing in the initial value to the closure along with the current iterated item then passing into the next iteration the value of the previous closure
`String` | `join(String separator)` Concatenates the `toString()` representation of each items in this array, with the given String as a separator between each item
`Object` | `max()` Adds max() method to Object arrays
`Object` | `max(Closure closure)` Selects the maximum value found from the Object array using the given closure as a comparator number) for each item passed
`Object` | `max(Comparator comparator)` Selects the maximum value found from the Object array using the given comparator
`Object` | `min()` Adds min() method to Object arrays
`Object` | `min(Comparator comparator)` Selects the minimum value found from the Object array using the given comparator
`Object` | `min(Closure closure)` Selects the minimum value found from the Object array using the given closure as a comparator number) for each item passed
`Object[]` | `minus(Collection removeMe)` Create an array composed of the elements of the first array minus the elements of the given collection
`Object[]` | `minus(Object[] removeMe)` Create an array composed of the elements of the first array minus the elements of the given array
`Object[]` | `minus(Object operand)` Create a new object array composed of the elements of the first array minus the operand
`void` | `putAt(int idx, Object value)` Support the subscript operator for an Array
`Object[]` | `reverse()` Reverse the items in an Object array
`Object[]` | `reverseEach(Closure closure)` Iterate over each element of the array in the reverse order
`int` | `size()` Provide the standard Groovy `size()` method for an array
`Object[]` | `sort()` Sorts the given Object array into sorted order assumed to be comparable
`Object[]` | `sort(Comparator comparator)` Sorts the given Object array into sorted order using the given comparator
`Object[]` | `sort(Closure closure)` Sorts the given Object array into a newly created array using the given comparator
`String` | `toArrayString()` Returns the string representation of the given array displays the contents of the array, similar to an array literal, i `{1, 2, "a"}`
`List` | `toList()` Allows conversion of arrays into a mutable List
`SpreadMap` | `toSpreadMap()` Creates a spreadable map from this array
`String` | `toString()` Returns the string representation of this array's contents

Method Detail

### asType

    public Object asType(Class clazz)

  Converts the given array to either a List, Set, or SortedSet. If the given class is something else, the call is deferred to {link #asType(Object,Class)}.

Parameters:
  `clazz` - the desired class.
Returns:
  the object resulting from this type conversion

See:
  #asType(Object,Class).

### equals

    public boolean equals(List right)

  Determines if the contents of this array are equal to the contents of the given list, in the same order. This returns `false` if either collection is `null`.

Parameters:
  `right` - the list being compared.
Returns:
  true if the contents of both collections are equal

### getAt

    public List getAt(Collection indices)

  Allows a List to be used as the indices to be used on a List

Parameters:
  `indices` - a Collection of indices.
Returns:
  a new list of the values at the given indices

### getAt

    public List getAt(Range range)

  Support the range subscript operator for an Array

Parameters:
  `range` - a Range.
Returns:
  a range of a list from the range's from index up to but not including the ranges's to value

### getAt

    public List getAt(IntRange range)

Parameters:

### getAt

    public List getAt(EmptyRange range)

Parameters:

### getAt

    public List getAt(ObjectRange range)

Parameters:

### getAt

    public Object getAt(int idx)

  Support the subscript operator for an Array.

Parameters:
  `idx` - an index.
Returns:
  the value at the given index

### inject

    public Object inject(Object initialValue, Closure closure)

  Iterates through the given array of objects, passing in the initial value to the closure along with the current iterated item then passing into the next iteration the value of the previous closure.

Parameters:
  `initialValue` - an initialValue.
  `closure` - a closure.
Returns:
  the last value of the last iteration

### join

    public String join(String separator)

  Concatenates the `toString()` representation of each items in this array, with the given String as a separator between each item.

Parameters:
  `separator` - a String separator.
Returns:
  the joined String

### max

    public Object max()

  Adds max() method to Object arrays.

Returns:
  the maximum value

See:
  #max.

### max

    public Object max(Closure closure)

  Selects the maximum value found from the Object array using the given closure as a comparator. The closure should return a comparable value (i.e. a number) for each item passed.

Parameters:
  `closure` - a closure used as a comparator.
Returns:
  the maximum value

See:
  #max.

### max

    public Object max(Comparator comparator)

  Selects the maximum value found from the Object array using the given comparator.

Parameters:
  `comparator` - a Comparator.
Returns:
  the maximum value

### min

    public Object min()

  Adds min() method to Object arrays.

Returns:
  the minimum value

See:
  #min.

### min

    public Object min(Comparator comparator)

  Selects the minimum value found from the Object array using the given comparator.

Parameters:
  `comparator` - a Comparator.
Returns:
  the minimum value

See:
  #min.

### min

    public Object min(Closure closure)

  Selects the minimum value found from the Object array using the given closure as a comparator. The closure should return a comparable value (i.e. a number) for each item passed.

Parameters:
  `closure` - a closure used as a comparator.
Returns:
  the minimum value

See:
  #min.

### minus

    public Object[] minus(Collection removeMe)

  Create an array composed of the elements of the first array minus the elements of the given collection.

Parameters:
  `removeMe` - a Collection of elements to remove.
Returns:
  an array with the supplied elements removed

### minus

    public Object[] minus(Object[] removeMe)

  Create an array composed of the elements of the first array minus the elements of the given array.

Parameters:
  `removeMe` - an array of elements to remove.
Returns:
  an array with the supplied elements removed

### minus

    public Object[] minus(Object operand)

  Create a new object array composed of the elements of the first array minus the operand.

Parameters:
  `operand` - an element to remove from the array.
Returns:
  a new array with the operand removed

### putAt

    public void putAt(int idx, Object value)

  Support the subscript operator for an Array.

Parameters:
  `idx` - an index.
  `value` - an Object to put at the given index.

### reverse

    public Object[] reverse()

  Reverse the items in an Object array.

Returns:
  an array containing the reversed items

### reverseEach

    public Object[] reverseEach(Closure closure)

  Iterate over each element of the array in the reverse order.

Parameters:
  `closure` - a closure to which each item is passed.
Returns:
  the original array

### size

    public int size()

  Provide the standard Groovy `size()` method for an array.

Returns:
  the size (length) of the Array

### sort

    public Object[] sort()

  Sorts the given Object array into sorted order. The array items are assumed to be comparable.

Returns:
  the sorted array

### sort

    public Object[] sort(Comparator comparator)

  Sorts the given Object array into sorted order using the given comparator.

Parameters:
  `comparator` - a Comparator used for the comparison.
Returns:
  the sorted array

### sort

    public Object[] sort(Closure closure)

  Sorts the given Object array into a newly created array using the given comparator.

Parameters:
  `closure` - a Closure used as a comparator.
Returns:
  the sorted array

### toArrayString

    public String toArrayString()

  Returns the string representation of the given array. The string displays the contents of the array, similar to an array literal, i.e. `{1, 2, "a"}`.

Returns:
  the string representation

### toList

    public List toList()

  Allows conversion of arrays into a mutable List.

Returns:
  the array as a List

### toSpreadMap

    public SpreadMap toSpreadMap()

  Creates a spreadable map from this array.

Returns:
  a newly created Spreadmap

See:
  SpreadMap#SpreadMap.

### toString

    public String toString()

  Returns the string representation of this array's contents.

Returns:
  the string representation

See:
  #toArrayString(Object[]).

Overview | Package | Class | Tree | Deprecated | Index | Help
| Groovy JDK