Package: java.lang

## [Java] Class Object[]

- java.lang.Object[]

-     public class Object[]
      extends Object

  GDK enhancements for Object[].

  displayName:
    Object[]
  receiverFqcn:
    java.lang.Object[]

- - ### Methods Summary

    Methods
    Type Params | Return Type | Name and description
    --- | --- | ---
    `<T>` | `public boolean` | `any(Closure<?> predicate)` Iterates over the contents of an Array, and checks whether a predicate is valid for at least one element.
    `<T>` | `public boolean` | `any(Predicate<? super T> predicate)` Returns true if any element of the array matches the given predicate.
    `` | `public boolean` | `asBoolean()` Coerces an object array to a boolean value.
    `<T>` | `public T` | `asType(Class<T> type)` Converts the given array to either a List, Set, or SortedSet.
    `` | `public Object` | `average()` Averages the items in an array.
    `<T>` | `public Object` | `average(Closure<?> closure)` Averages the result of applying a closure to each item of an array.
    `<T>` | `public List<List<T>>` | `chop(int chopSizes)` Chops the array into pieces, returning lists with sizes corresponding to the supplied chop sizes.
    `<T>` | `public List<List<T>>` | `collate(int size)` Collates an array.
    `<T>` | `public List<List<T>>` | `collate(int size, int step)` Collates an array into sub-lists.
    `<T>` | `public List<List<T>>` | `collate(int size, boolean keepRemainder)` Collates this array into sub-lists.
    `<T>` | `public List<List<T>>` | `collate(int size, int step, boolean keepRemainder)` Collates this array into sub-lists.
    `<E, T>` | `public List<T>` | `collect(Closure<T> transform)` Iterates through this Array transforming each item into a new value using the `transform` closure, returning a list of transformed values.
    `<E, T>` | `public List<T>` | `collect(Function<? super E, ? extends T> transform)` Iterates through an array transforming each element using the transform function.
    `<E, T, C extends java.util.Collection<T>>` | `public C` | `collect(C collector, Closure<? extends T> transform)` Iterates through this Array transforming each item into a new value using the `transform` closure and adding it to the supplied `collector`.
    `<E, T, C extends java.util.Collection<T>>` | `public C` | `collect(C collector, Function<? super E, ? extends T> transform)` Iterates through an array transforming each element using the transform function and adding it to the collector.
    `<K, V, E>` | `public Map<K, V>` | `collectEntries()` A variant of collectEntries using the identity closure as the transform.
    `<K, V, E>` | `public Map<K, V>` | `collectEntries(Map<K, V> collector)` A variant of collectEntries using the identity closure as the transform.
    `<K, V, E>` | `public Map<K, V>` | `collectEntries(Closure<?> transform)` Iterates through this array transforming each item using the `transform` closure and returning a map of the resulting transformed entries.
    `<K, V, E>` | `public Map<K, V>` | `collectEntries(Function<? super E, ? extends Entry<K, V>> transform)` Iterates through an array transforming each element into a map entry using the transform function.
    `<K, V, E>` | `public Map<K, V>` | `collectEntries(Map<K, V> collector, Closure<?> transform)` Iterates through this array transforming each item using the `transform` closure and returning a map of the resulting transformed entries.
    `<K, V, E>` | `public Map<K, V>` | `collectEntries(Map<K, V> collector, Function<? super E, ? extends Entry<K, V>> transform)` Iterates through an array transforming each element into a map entry using the transform function and adding it to the collector.
    `<K, V, E>` | `public Map<K, V>` | `collectEntries(Function<? super E, K> keyTransform, Function<? super E, V> valueTransform)` A variant of collectEntries for arrays with separate functions for transforming the keys and values.
    `<K, V, E>` | `public Map<K, V>` | `collectEntries(Map<K, V> collector, Function<? super E, K> keyTransform, Function<? super E, V> valueTransform)` A variant of collectEntries for arrays with separate functions for transforming the keys and values.
    `<T, E>` | `public List<T>` | `collectMany(Closure<? extends Collection<? extends T>> projection)` Projects each item from a source array to a collection and concatenates (flattens) the resulting collections into a single list.
    `<T, E>` | `public List<T>` | `collectMany(Function<? super E, ? extends Collection<? extends T>> projection)` Projects each item from a source array to a collection and concatenates (flattens) the resulting collections into a single list.
    `<T, E, C extends java.util.Collection<T>>` | `public C` | `collectMany(C collector, Closure<? extends Collection<? extends T>> projection)` Projects each item from a source array to a collection and concatenates (flattens) the resulting collections into a single list.
    `<T, E, C extends java.util.Collection<T>>` | `public C` | `collectMany(C collector, Function<? super E, ? extends Collection<? extends T>> projection)` Projects each item from a source array to a result collection and concatenates (flattens) the resulting collections adding them into the `collector`.
    `` | `public boolean` | `contains(Object value)` Checks whether the array contains the given value.
    `` | `public Number` | `count(Object value)` Counts the number of occurrences of the given value inside this array.
    `<T>` | `public Number` | `count(Closure<?> predicate)` Counts the number of occurrences which satisfy the given closure from inside this array.
    `<T>` | `public Number` | `count(Predicate<? super T> predicate)` Counts the number of array elements matching the given predicate.
    `<K, E>` | `public Map<K, Integer>` | `countBy(Closure<K> closure)` Sorts all array members into groups determined by the supplied mapping closure and counts the group size.
    `<K, E>` | `public Map<K, Integer>` | `countBy(Function<? super E, ? extends K> function)` Sorts all array members into groups determined by the supplied mapping function and counts the group size.
    `<E>` | `public Map<E, Integer>` | `countBy()` Creates a multiset-like map of the array members.
    `<T>` | `public T[]` | `drop(int num)` Drops the given number of elements from the head of this array if they are available.
    `<T>` | `public T[]` | `dropRight(int num)` Drops the given number of elements from the tail of this array if they are available.
    `<T>` | `public T[]` | `dropWhile(Closure<?> condition)` Create a suffix of the given array by dropping as many elements as possible from the front of the original array such that calling the given closure condition evaluates to true when passed each of the dropped elements.
    `<T>` | `public T[]` | `dropWhile(Predicate<? super T> condition)` Returns a suffix of an array where elements are dropped from the front while the predicate is satisfied.
    `<T>` | `public T[]` | `each(Closure<?> closure)` Iterates through an array passing each array entry to the given closure.
    `<T>` | `public T[]` | `each(Consumer<? super T> consumer)` Iterates through an array, passing each element to the given consumer.
    `<T>` | `public T[]` | `eachWithIndex(Closure<?> closure)` Iterates through an array, passing each array element and the element's index (a counter starting at zero) to the given closure.
    `<T>` | `public T[]` | `eachWithIndex(ObjIntConsumer<? super T> consumer)` Iterates through an array, passing each element and its index to the given consumer.
    `` | `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.
    `<T>` | `public boolean` | `every(Closure<?> predicate)` Used to determine if the given predicate closure is valid (i.e. returns `true` for all items in this Array).
    `<T>` | `public boolean` | `every(Predicate<? super T> predicate)` Returns true if every element of the array matches the given predicate.
    `<T>` | `public T` | `find(Closure<?> condition)` Finds the first element in the array that matches the given closure condition.
    `<T>` | `public T` | `find(Predicate<? super T> condition)` Finds the first element in the array that matches the given predicate, or null if none match.
    `<T>` | `public List<T>` | `findAll()` Finds the elements of the array matching the IDENTITY Closure (i.e. matching Groovy truth).
    `<T>` | `public List<T>` | `findAll(Closure<?> condition)` Finds all elements of the array matching the given Closure condition.
    `<T>` | `public List<T>` | `findAll(Predicate<? super T> condition)` Finds all elements of the array matching the given predicate.
    `<T>` | `public int` | `findIndexOf(Closure<?> condition)` Iterates over the elements of an array and returns the index of the first item that satisfies the condition specified by the closure.
    `<T>` | `public int` | `findIndexOf(int startIndex, Closure<?> condition)` Iterates over the elements of an array, starting from a specified index, and returns the index of the first item that satisfies the condition specified by the closure.
    `<T>` | `public List<Number>` | `findIndexValues(Closure<?> condition)` Iterates over the elements of an array and returns the index values of the items that match the condition specified in the closure.
    `<T>` | `public List<Number>` | `findIndexValues(Number startIndex, Closure<?> condition)` Iterates over the elements of an array, starting from a specified index, and returns the index values of the items that match the condition specified in the closure.
    `<T>` | `public int` | `findLastIndexOf(Closure<?> condition)` Returns the index of the last item that matches the specified condition.
    `<T>` | `public int` | `findLastIndexOf(int lowerBound, Closure<?> condition)` Returns the index of the last item that matches the specified condition that is at or beyond the given index.
    `<T>` | `public T` | `findResult()` Iterates through the Array stopping once the first non-null result is found and returning that result.
    `<T, U extends T, V extends T>` | `public T` | `findResult(V defaultResult)` Iterates through the Array stopping once the first non-null result is found and returning that result.
    `<S, T>` | `public T` | `findResult(Closure<T> condition)` Iterates through the Array calling the given closure condition for each item but stopping once the first non-null result is found and returning that result.
    `<S, T, U extends T, V extends T>` | `public T` | `findResult(U defaultResult, Closure<V> condition)` Iterates through the Array calling the given closure condition for each item but stopping once the first non-null result is found and returning that result.
    `<T>` | `public Collection<T>` | `findResults()` Iterates through the Array collecting any non-null results.
    `<T, U>` | `public Collection<T>` | `findResults(Closure<T> filteringTransform)` Iterates through the Array transforming items using the supplied closure and collecting any non-null results.
    `<T>` | `public T` | `first()` Returns the first item from the array.
    `` | `public List<Object>` | `flatten()` Flattens an array.
    `` | `public Collection` | `flattenMany(Closure<?> transform)` Flatten an array.
    `<T>` | `public List<T>` | `getAt(Range<?> range)` Supports the subscript operator for an object array with a range giving the desired indices.
    `<T>` | `public List<T>` | `getAt(IntRange range)` Supports the subscript operator for an object array with an IntRange giving the desired indices.
    `<T>` | `public List<T>` | `getAt(ObjectRange range)` Supports the subscript operator for an object array with an ObjectRange giving the desired indices.
    `<T>` | `public List<T>` | `getAt(EmptyRange<?> range)` Supports the subscript operator for an object array with an EmptyRange.
    `<T>` | `public List<T>` | `getAt(Collection<?> indices)` Selects a List of items from an array using a Collection to identify the indices to be selected.
    `<T>` | `public IntRange` | `getIndices()` Returns indices of the array.
    `<T>` | `public List<T>` | `grep()` Iterates over the array returning each element that matches using the IDENTITY Closure as a filter - effectively returning all elements which satisfy Groovy truth.
    `<T>` | `public List<T>` | `grep(Object filter)` Iterates over the array of items and returns a collection of items that match the given filter - calling the DefaultGroovyMethods#isCase(Object,Object)#isCase(Object,Object) method used by switch statements.
    `` | `public String` | `groovyToString()` Returns Groovy's list-like string representation for an Object array.
    `<K, T>` | `public Map<K, List<T>>` | `groupBy(Closure<K> closure)` Sorts all array members into groups determined by the supplied mapping closure.
    `<K, T>` | `public Map<K, List<T>>` | `groupBy(Function<? super T, ? extends K> function)` Sorts all array members into groups determined by the supplied mapping function.
    `` | `public Map` | `groupBy(Object closures)` Sorts all array members into (sub)groups determined by the supplied mapping closures as per the Iterable variant of this method.
    `` | `public Map` | `groupBy(List<Closure<?>> closures)` Sorts all array members into (sub)groups determined by the supplied mapping closures as per the list variant of this method.
    `<T, K>` | `public Map<K, List<T>>` | `groupByMany(Function<? super T, ? extends Iterable<? extends K>> keyFn)` Groups all array members into (sub)groups determined by the supplied key mapping closure.
    `<T, U, K>` | `public Map<K, List<U>>` | `groupByMany(Function<? super T, ? extends U> valueFn, Function<? super T, ? extends Iterable<? extends K>> keyFn)` Groups all members from the array into (sub)groups determined by the supplied key mapping closure.
    `<T>` | `public List<List<T>>` | `groupConsecutive()` Splits this array into a list of sublists, each a maximal run of adjacent elements considered equal (number-aware coercion).
    `<T, K>` | `public List<List<T>>` | `groupConsecutive(Function<? super T, ? extends K> keyFn)` Splits this array into runs of adjacent elements whose key, as computed by the given function, is equal (number-aware coercion).
    `<T>` | `public List<List<T>>` | `groupConsecutive(BiPredicate<? super T, ? super T> sameRun)` Splits this array into runs where the given predicate, applied to the current run's previous element and the next element, holds.
    `<T>` | `public T` | `head()` Returns the first item from the Object array.
    `` | `public int` | `indexOf(Object object)` Returns the index of the first occurrence of the specified element in the array.
    `<T>` | `public Map<Integer, T>` | `indexed()` Zips an object array with indices in (index, value) order starting from index 0.
    `<T>` | `public Map<Integer, T>` | `indexed(int offset)` Zips an object array with indices in (index, value) order starting from a given index.
    `<T>` | `public T[]` | `init()` Returns the items from the Object array excluding the last item.
    `<E extends T, T, V extends T>` | `public T` | `inject(Closure<V> closure)` Iterates through the given array, passing the first two elements to the closure.
    `<T>` | `public T` | `inject(BinaryOperator<T> operator)` Iterates through the given array, passing the first two elements to the operator.
    `<E, T, U extends T, V extends T>` | `public T` | `inject(U initialValue, Closure<V> closure)` Iterates through the given array, passing in the initial value and the first element to the closure.
    `<E, U>` | `public U` | `inject(U initialValue, BiFunction<? super U, ? super E, ? extends U> function)` Iterates through the given array, passing in the initial value and the first element to the function.
    `<E extends T, T, V extends T>` | `public List<T>` | `injectAll(Closure<V> closure)` Iterates through the given array, injecting values as per `inject` but returns the list of all calculated values instead of just the final result.
    `<T>` | `public List<T>` | `injectAll(BinaryOperator<T> operator)` Iterates through the given array, injecting values as per `inject` but returns the list of all calculated values instead of just the final result.
    `<E, T, U extends T, V extends T>` | `public List<T>` | `injectAll(U initialValue, Closure<V> closure)` Iterates through the given array, injecting values as per `inject` but returns the list of all calculated values instead of just the final result.
    `<E, U>` | `public List<U>` | `injectAll(U initialValue, BiFunction<? super U, ? super E, ? extends U> function)` Iterates through the given array, injecting values as per `inject` but returns the list of all calculated values instead of just the final result.
    `<T>` | `public boolean` | `isSorted()` Determines if the array is sorted in natural order using a NumberAwareComparator.
    `<T>` | `public boolean` | `isSorted(Comparator<? super T> comparator)` Determines if the array is sorted according to the given Comparator.
    `<T>` | `public boolean` | `isSorted(Function<? super T, ?> keyExtractor)` Determines if the array is sorted in non-descending order of the keys returned by the given key extractor.
    `<T>` | `public Iterator<T>` | `iterator()` Returns an Iterator which traverses the given array in index order.
    `` | `public String` | `join()` Concatenates the string representation of each item in this array.
    `` | `public String` | `join(String separator)` Concatenates the string representation of each item in this array, with the given String as a separator between each item.
    `<T>` | `public T` | `last()` Returns the last item from the array.
    `` | `public int` | `lastIndexOf(Object object)` Returns the index of the last occurrence of the specified element in the array.
    `<T>` | `public T` | `max()` Adds max() method to Object arrays.
    `<T>` | `public T` | `max(Comparator<? super T> comparator)` Selects the maximum value found from the Object array using the given comparator.
    `<T>` | `public T` | `max(Closure<?> closure)` Selects the maximum value found from the Object array using the closure to determine the correct ordering.
    `<T>` | `public T` | `min()` Adds min() method to Object arrays.
    `<T>` | `public T` | `min(Comparator<? super T> comparator)` Selects the minimum value found from the Object array using the given comparator.
    `<T>` | `public T` | `min(Closure<?> closure)` Selects the minimum value found from the Object array using the closure to determine the correct ordering.
    `<T>` | `public T[]` | `minus(Iterable<?> removeMe)` Creates a new array composed of the elements of the first array minus the elements of the given Iterable.
    `<T>` | `public T[]` | `minus(Object[] removeMe)` Creates a new array composed of the elements of the first array minus the elements of the given array.
    `<T>` | `public T[]` | `minus(Object removeMe)` Creates a new array composed of the elements of the given array minus every occurrence the given object.
    `<T>` | `public int` | `partitionPoint(IntRange range, Predicate<? super T> condition)` Returns the index of the partition point according to the given predicate (the index of the first element of the second partition).
    `<T>` | `public int` | `partitionPoint(Predicate<? super T> condition)` Returns the index of the partition point according to the given predicate (the index of the first element of the second partition).
    `<T>` | `public T[]` | `plus(Collection<?> right)` Creates an array containing elements from an original array plus those from a Collection.
    `<T>` | `public T[]` | `plus(Iterable<?> right)` Creates an array containing elements from an original array plus those from an Iterable.
    `<T>` | `public T[]` | `plus(Object[] right)` Creates an array as a union of two arrays.
    `<T>` | `public T[]` | `plus(Object right)` Creates an array containing elements from an original array plus an additional appended element.
    `<T>` | `public void` | `putAt(IntRange range, T[] source)` A helper method to allow arrays to be set with subscript operators.
    `<T>` | `public void` | `putAt(IntRange range, Iterable<T> source)` A helper method to allow arrays to be set with subscript operators.
    `<T>` | `public T[]` | `reverse()` Creates a new array containing items which are the same as this array but in reverse order.
    `<T>` | `public T[]` | `reverse(boolean mutate)` Reverses the items in an array.
    `<T>` | `public T[]` | `reverseEach(Closure<?> closure)` Iterates over each element of the array in the reverse order.
    `<T>` | `public void` | `shuffle()` Randomly reorders the elements of the specified array.
    `<T>` | `public void` | `shuffle(Random rnd)` Randomly reorders the elements of the specified array using the specified random instance as the source of randomness.
    `<T>` | `public T[]` | `shuffled()` Creates a new array containing the elements of the specified array but in a random order.
    `<T>` | `public T[]` | `shuffled(Random rnd)` Creates a new array containing the elements of the specified array but in a random order using the specified random instance as the source of randomness.
    `` | `public int` | `size()` Provides the standard Groovy `size()` method for an array.
    `<T>` | `public T[]` | `sort()` Modifies this array so that its elements are in sorted order.
    `<T>` | `public T[]` | `sort(boolean mutate)` Sorts the given array into sorted order.
    `<T>` | `public T[]` | `sort(Comparator<? super T> comparator)` Sorts the given array into sorted order using the given comparator.
    `<T>` | `public T[]` | `sort(boolean mutate, Comparator<? super T> comparator)` Sorts the elements from this array into sorted order as determined by the given comparator.
    `<T>` | `public T[]` | `sort(Closure<?> closure)` Sorts the elements from this array into a newly created array using the Closure to determine the correct ordering.
    `<T>` | `public T[]` | `sort(IntRange range, Closure<?> closure)` Sorts the elements from this array with index values in the given index range into a newly created array using the Closure to determine the correct ordering.
    `<T>` | `public T[]` | `sort(boolean mutate, Closure<?> closure)` Sorts the elements from this array into sorted order using the Closure to determine the correct ordering.
    `<T>` | `public T[]` | `sort(IntRange range, boolean mutate, Closure<?> closure)` Sorts the elements with index values in the given index range into sorted order using the Closure to determine the correct ordering.
    `<T>` | `public Collection<Collection<T>>` | `split(Closure<?> closure)` Splits all items into two collections based on the closure condition.
    `<T>` | `public Collection<Collection<T>>` | `split(Predicate<? super T> predicate)` Splits all array items into two collections based on the predicate.
    `<T>` | `public Stream<T>` | `stream()` Returns a sequential Stream with the specified array as its source.
    `` | `public Object` | `sum()` Sums the items in an array.
    `` | `public Object` | `sum(Object initialValue)` Sums the items in an array, adding the result to some initial value.
    `<T>` | `public Object` | `sum(Closure<?> closure)` Sums the result of applying a closure to each item of an array.
    `<T>` | `public Object` | `sum(Object initialValue, Closure<?> closure)` Sums the result of applying a closure to each item of an array to some initial value.
    `<T>` | `public T[]` | `swap(int i, int j)` Swaps two elements at the specified positions.
    `<T>` | `public T[]` | `tail()` Returns the items from the array excluding the first item.
    `<T>` | `public T[]` | `take(int num)` Returns the first `num` elements from the head of this array.
    `<T>` | `public T[]` | `takeRight(int num)` Returns the last `num` elements from the tail of this array.
    `<T>` | `public T[]` | `takeWhile(Closure<?> condition)` Returns the longest prefix of this array where each element passed to the given closure evaluates to true.
    `<T>` | `public T[]` | `takeWhile(Predicate<? super T> condition)` Returns the longest prefix of an array where each element passes the given predicate.
    `<T>` | `public List<T>` | `toImmutableList()` Converts this array to an immutable List of the same size, with each element added to the list.
    `<T>` | `public Set<T>` | `toImmutableSet()` Converts this array to an immutable Set, with each unique element added to the set.
    `<T>` | `public List<T>` | `toList()` Converts this array to a List of the same size, with each element added to the list.
    `<T>` | `public Set<T>` | `toSet()` Converts this array to a Set, with each unique element added to the set.
    `<T>` | `public T[]` | `toSorted()` Returns a sorted version of the given array using the supplied comparator.
    `<T>` | `public T[]` | `toSorted(Comparator<? super T> comparator)` Returns a sorted version of the given array using the supplied comparator to determine the resulting order.
    `<T>` | `public T[]` | `toSorted(Closure<?> closure)` Sorts the elements from this array into a newly created array using the Closure to determine the correct ordering.
    `` | `public SpreadMap` | `toSpreadMap()` Creates a spreadable map from this array.
    `` | `public String` | `toString()` Returns the string representation of the given array.
    `<T>` | `public T[]` | `toUnique()` Returns a new Array containing the items from the original Array but with duplicates removed using the natural ordering of the items in the array.
    `<T>` | `public T[]` | `toUnique(Comparator<? super T> comparator)` Returns a new Array containing the items from the original Array but with duplicates removed with the supplied comparator determining which items are unique.
    `<T>` | `public T[]` | `toUnique(Closure<?> closure)` Returns a new Array containing the items from the original Array but with duplicates removed with the supplied closure determining which items are unique.
    `` | `public Object[]` | `union(Collection<?> right)` Creates an object array containing elements from an original array plus those from a Collection.
    `` | `public Object[]` | `union(Iterable<?> right)` Creates an Object array containing elements from an original array plus those from an Iterable.
    `` | `public Object[]` | `union(Object[] right)` Creates an Object array as a union of two arrays.
    `` | `public Object[]` | `union(Object right)` Creates an Object array containing elements from an original array plus an additional appended element.
    `<K, V>` | `public Map<K, V>` | `withCollectedKeys(Function<? super V, K> keyTransform)` A variant of withCollectedKeys for arrays.
    `<K, V>` | `public Map<K, V>` | `withCollectedKeys(Map<K, V> collector, Function<? super V, K> keyTransform)` A variant of withCollectedKeys for arrays.
    `<K, V>` | `public Map<K, V>` | `withCollectedValues(Function<? super K, V> valueTransform)` A variant of withCollectedValues for arrays.
    `<K, V>` | `public Map<K, V>` | `withCollectedValues(Map<K, V> collector, Function<? super K, V> valueTransform)` A variant of withCollectedValues for arrays.
    `<T>` | `public List<Tuple2<T, Integer>>` | `withIndex()` Zips an object array with indices in (value, index) order.
    `<T>` | `public List<Tuple2<T, Integer>>` | `withIndex(int offset)` Zips an object array with indices in (value, index) order starting from a given index.
    `<T>` | `public List<Tuple2<T, T>>` | `zipWithNext()` Returns a list of all the successive adjacent pairs from this array (a sliding window of size 2, step 1).
    `<T, R>` | `public List<R>` | `zipWithNext(BiFunction<? super T, ? super T, ? extends R> combiner)` Applies the combiner to each successive adjacent pair from this array, returning the list of results.

  - ### Inherited Methods Summary

    Inherited Methods
    Methods inherited from class | Name
    --- | ---
    `class Object` | `addShutdownHook, any, any, asBoolean, asType, clamp, clamp, collect, collect, collect, dump, each, eachMatch, eachMatch, eachWithIndex, every, every, find, find, findAll, findAll, findIndexOf, findIndexOf, findIndexValues, findIndexValues, findLastIndexOf, findLastIndexOf, findResult, findResult, findResult, findResult, getAt, getMetaClass, getMetaPropertyValues, getProperties, grep, grep, hasProperty, identity, inject, inject, inject, inject, inspect, invokeMethod, is, isCase, isNotCase, iterator, metaClass, print, print, printf, printf, println, println, println, putAt, respondsTo, respondsTo, setMetaClass, sleep, sleep, split, sprintf, sprintf, stream, takeIf, tap, toString, use, use, use, with, with, withCloseable, withCloseable, withMethodClosure, withStream, withStream, withTraits`

- - ### Method Detail

    - #### <T> public boolean any(Closure<?> predicate)

      Iterates over the contents of an Array, and checks whether a predicate is valid for at least one element.

      Parameters:
        `predicate` - the closure predicate used for matching
      Returns:
        true if any iteration for the object matches the closure predicate
      Since:
        2.5.0

    - #### <T> public boolean any(Predicate<? super T> predicate)

      Returns true if any element of the array matches the given predicate. A "fat-free" variant of Object accepting a Predicate.

           Integer[] nums = [1, 2, 3]
           assert nums.any(n -> n > 2)
           assert !nums.any(n -> n > 5)

      Parameters:
        `predicate` - the predicate evaluated against each element
      Returns:
        true if any element satisfies the predicate
      Since:
        6.0.0

    - #### public boolean asBoolean()

      Coerces an object array to a boolean value. An Object array is false if the array is of length 0. and to true otherwise

      Returns:
        the boolean value
      Since:
        1.7.0

    - #### <T> public T asType(Class<T> type)

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

      Parameters:
        `type` - the desired class
      Returns:
        the object resulting from this type conversion
      Since:
        1.5.1

    - #### public Object average()

      Averages the items in an array. This is equivalent to invoking the "plus" method on all items in the array and then dividing by the total count using the "div" method for the resulting sum.

           assert 3 == ([1, 2, 6] as Integer[]).average()

      Returns:
        The average of all the items
      See Also:
        sum(java.lang.Object[])
      Since:
        3.0.0

    - #### <T> public Object average(Closure<?> closure)

      Averages the result of applying a closure to each item of an array. `array.average(closure)` is equivalent to: `array.collect(closure).average()`.

           def (nums, strings) = [[1, 3] as Integer[], ['to', 'from'] as String[]]
           assert 20 == nums.average { it * 10 }
           assert 3 == strings.average { it.size() }
           assert 3 == strings.average (String::size)

      Parameters:
        `closure` - a single parameter closure that returns a (typically) numeric value.
      Returns:
        The average of the values returned by applying the closure to each item of the array.
      Since:
        3.0.0

    - #### <T> public List<List<T>> chop(int chopSizes)

      Chops the array into pieces, returning lists with sizes corresponding to the supplied chop sizes. If the array isn't large enough, truncated (possibly empty) pieces are returned. Using a chop size of -1 will cause that piece to contain all remaining items from the array.

      Parameters:
        `chopSizes` - the sizes for the returned pieces
      Returns:
        a list of lists chopping the original array elements into pieces determined by chopSizes
      See Also:
        to chop a list into pieces of a fixed size
      Since:
        2.5.2

    - #### <T> public List<List<T>> collate(int size)

      Collates an array.

      Parameters:
        `size` - the length of each sub-list in the returned list
      Returns:
        a List containing the array values collated into sub-lists
      See Also:
        DefaultGroovyMethods#collate(Iterable, int)#collate(Iterable, int)
      Since:
        2.5.0

    - #### <T> public List<List<T>> collate(int size, int step)

      Collates an array into sub-lists.

      Parameters:
        `size` - the length of each sub-list in the returned list
        `step` - the number of elements to step through for each sub-list
      Returns:
        a List containing the array elements collated into sub-lists
      See Also:
        DefaultGroovyMethods#collate(Iterable, int, int)#collate(Iterable, int, int)
      Since:
        2.5.0

    - #### <T> public List<List<T>> collate(int size, boolean keepRemainder)

      Collates this array into sub-lists.

      Parameters:
        `size` - the length of each sub-list in the returned list
        `keepRemainder` - if true, any remaining elements are returned as sub-lists; otherwise, they are discarded
      Returns:
        a List containing the array elements collated into sub-lists
      See Also:
        DefaultGroovyMethods#collate(Iterable, int, boolean)#collate(Iterable, int, boolean)
      Since:
        2.5.0

    - #### <T> public List<List<T>> collate(int size, int step, boolean keepRemainder)

      Collates this array into sub-lists.

      Parameters:
        `size` - the length of each sub-list in the returned list
        `step` - the number of elements to step through for each sub-list
        `keepRemainder` - if true, any remaining elements are returned as sub-lists; otherwise, they are discarded
      Returns:
        a List containing the array elements collated into sub-lists
      Since:
        2.5.0

    - #### <E, T> public List<T> collect(Closure<T> transform)

      Iterates through this Array transforming each item into a new value using the `transform` closure, returning a list of transformed values.

      Parameters:
        `transform` - the closure used to transform each item of the Array
      Returns:
        A list of the transformed values.
      Since:
        2.5.0

    - #### <E, T> public List<T> collect(Function<? super E, ? extends T> transform)

      Iterates through an array transforming each element using the transform function. A "fat-free" variant of Object accepting a Function.

           Integer[] nums = [1, 2, 3]
           assert nums.collect(n -> n * 2) == [2, 4, 6]

      Parameters:
        `transform` - the transform function applied to each element
      Returns:
        a List of the transformed values
      Since:
        6.0.0

    - #### <E, T, C extends java.util.Collection<T>> public C collect(C collector, Closure<? extends T> transform)

      Iterates through this Array transforming each item into a new value using the `transform` closure and adding it to the supplied `collector`.

           Integer[] nums = [1,2,3]
           List answer = []
           nums.collect(answer) { it * 2 }
           assert answer == [2,4,6]

      Parameters:
        `collector` - the Collection to which the transformed values are added
        `transform` - the closure used to transform each item
      Returns:
        The collector with all transformed values added to it.
      Since:
        2.5.0

    - #### <E, T, C extends java.util.Collection<T>> public C collect(C collector, Function<? super E, ? extends T> transform)

      Iterates through an array transforming each element using the transform function and adding it to the collector. A "fat-free" variant of Object accepting a Function.

           Integer[] nums = [1, 2, 3]
           assert nums.collect(['x'], n -> n * 2) == ['x', 2, 4, 6]

      Parameters:
        `collector` - an initial collection to add the transformed values to
        `transform` - the transform function applied to each element
      Returns:
        the collector with the transformed values added to it
      Since:
        6.0.0

    - #### <K, V, E> public Map<K, V> collectEntries()

      A variant of collectEntries using the identity closure as the transform.

      Returns:
        the collector with all transformed values added to it
      See Also:
        collectEntries(Object[], Closure)
      Since:
        1.8.5

    - #### <K, V, E> public Map<K, V> collectEntries(Map<K, V> collector)

      A variant of collectEntries using the identity closure as the transform.

      Parameters:
        `collector` - the Map into which the transformed entries are put
      Returns:
        the collector with all transformed values added to it
      See Also:
        collectEntries(Object[], Map, Closure)
      Since:
        1.8.5

    - #### <K, V, E> public Map<K, V> collectEntries(Closure<?> transform)

      Iterates through this array transforming each item using the `transform` closure and returning a map of the resulting transformed entries.

           def letters = "abc"
           def nums = [0, 1, 2] as Integer[]
           // collect letters with index using list style
           assert nums.collectEntries { index -> [index, letters[index]] } == [0:'a', 1:'b', 2:'c']
           // collect letters with index using map style
           assert nums.collectEntries { index -> [(index): letters[index]] } == [0:'a', 1:'b', 2:'c']

      Note: When using the list-style of result, the behavior is '`def (key, value) = listResultFromClosure`'. While we strongly discourage using a list of size other than 2, Groovy's normal semantics apply in this case; throwing away elements after the second one and using null for the key or value for the case of a shortened list.
      Parameters:
        `transform` - the closure used for transforming, which has an item from self as the parameter and should return a Map.Entry, a Map or a two-element list containing the resulting key and value
      Returns:
        a Map of the transformed entries
      See Also:
        DefaultGroovyMethods#collectEntries(Iterator, Map, Closure)#collectEntries(Iterator, Map, Closure)
      Since:
        1.7.9

    - #### <K, V, E> public Map<K, V> collectEntries(Function<? super E, ? extends Entry<K, V>> transform)

      Iterates through an array transforming each element into a map entry using the transform function. A "fat-free" variant of Object accepting a Function.

           String[] words = ['a', 'bb', 'ccc']
           assert words.collectEntries(w -> new MapEntry(w, w.size())) == [a: 1, bb: 2, ccc: 3]

      Parameters:
        `transform` - the transform function applied to each element, returning a map entry
      Returns:
        a Map of the collected entries
      Since:
        6.0.0

    - #### <K, V, E> public Map<K, V> collectEntries(Map<K, V> collector, Closure<?> transform)

      Iterates through this array transforming each item using the `transform` closure and returning a map of the resulting transformed entries.

           def letters = "abc"
           def nums = [0, 1, 2] as Integer[]
           // collect letters with index
           assert nums.collectEntries( [:] ) { index -> [index, letters[index]] } == [0:'a', 1:'b', 2:'c']
           assert nums.collectEntries( [4:'d'] ) { index -> [(index+1): letters[index]] } == [1:'a', 2:'b', 3:'c', 4:'d']

      Note: When using the list-style of result, the behavior is '`def (key, value) = listResultFromClosure`'. While we strongly discourage using a list of size other than 2, Groovy's normal semantics apply in this case; throwing away elements after the second one and using null for the key or value for the case of a shortened list. If your collector Map doesn't support null keys or values, you might get a runtime error, e.g. NullPointerException or IllegalArgumentException.
      Parameters:
        `collector` - the Map into which the transformed entries are put
        `transform` - the closure used for transforming, which has an item from self as the parameter and should return a Map.Entry, a Map or a two-element list containing the resulting key and value
      Returns:
        the collector with all transformed values added to it
      See Also:
        DefaultGroovyMethods#collect(Map, Collection, Closure)#collect(Map, Collection, Closure)
      Since:
        1.7.9

    - #### <K, V, E> public Map<K, V> collectEntries(Map<K, V> collector, Function<? super E, ? extends Entry<K, V>> transform)

      Iterates through an array transforming each element into a map entry using the transform function and adding it to the collector. A "fat-free" variant of Object accepting a Function.

           String[] words = ['bb', 'ccc']
           assert words.collectEntries([a: 1], w -> new MapEntry(w, w.size())) == [a: 1, bb: 2, ccc: 3]

      Parameters:
        `collector` - an initial map to add the collected entries to
        `transform` - the transform function applied to each element, returning a map entry
      Returns:
        the collector with the collected entries added to it
      Since:
        6.0.0

    - #### <K, V, E> public Map<K, V> collectEntries(Function<? super E, K> keyTransform, Function<? super E, V> valueTransform)

      A variant of collectEntries for arrays with separate functions for transforming the keys and values.

           String[] languages = ['Groovy', 'Java', 'Kotlin', 'Scala']
           def firstLetter = (s) -> s[0]
           assert languages.collectEntries(firstLetter, String::size) == [G:6, J:4, K:6, S:5]

      Parameters:
        `keyTransform` - a function for transforming array elements into keys
        `valueTransform` - a function for transforming array elements into values
      Returns:
        a Map of the transformed entries
      Since:
        5.0.0

    - #### <K, V, E> public Map<K, V> collectEntries(Map<K, V> collector, Function<? super E, K> keyTransform, Function<? super E, V> valueTransform)

      A variant of collectEntries for arrays with separate functions for transforming the keys and values. The supplied collector map is used as the destination for transformed entries.

      Parameters:
        `collector` - the Map into which the transformed entries are put
        `keyTransform` - a function for transforming array elements into keys
        `valueTransform` - a function for transforming array elements into values
      Returns:
        the collector with all transformed values added to it
      Since:
        5.0.0

    - #### <T, E> public List<T> collectMany(Closure<? extends Collection<? extends T>> projection)

      Projects each item from a source array to a collection and concatenates (flattens) the resulting collections into a single list.

           def nums = [1, 2, 3, 4, 5, 6] as Object[]
           def squaresAndCubesOfEvens = nums.collectMany{ it % 2 ? [] : [it**2, it**3] }
           assert squaresAndCubesOfEvens == [4, 8, 16, 64, 36, 216]

      Parameters:
        `projection` - a projecting Closure returning a collection of items
      Returns:
        A list created from the projected collections concatenated (flattened) together.
      Since:
        1.8.1

    - #### <T, E> public List<T> collectMany(Function<? super E, ? extends Collection<? extends T>> projection)

      Projects each item from a source array to a collection and concatenates (flattens) the resulting collections into a single list. A "fat-free" variant of Object accepting a Function.

           Integer[] nums = 1..10
           def squaresAndCubesOfEvens = nums.collectMany(n -> n % 2 ? [] : [n**2, n**3])
           assert squaresAndCubesOfEvens == [4, 8, 16, 64, 36, 216, 64, 512, 100, 1000]

      Parameters:
        `projection` - a projecting function returning a collection of items
      Returns:
        a list created from the projected collections concatenated (flattened) together
      Since:
        6.0.0

    - #### <T, E, C extends java.util.Collection<T>> public C collectMany(C collector, Closure<? extends Collection<? extends T>> projection)

      Projects each item from a source array to a collection and concatenates (flattens) the resulting collections into a single list.

           def nums = [1, 2, 3, 4, 5, 6] as Object[]
           def squaresAndCubesOfEvens = nums.collectMany{ it % 2 ? [] : [it**2, it**3] }
           assert squaresAndCubesOfEvens == [4, 8, 16, 64, 36, 216]

      Parameters:
        `collector` - an initial collection to add the projected items to
        `projection` - a projecting Closure returning a collection of items
      Returns:
        The collector with the projected collections concatenated (flattened) to it.
      Since:
        1.8.1

    - #### <T, E, C extends java.util.Collection<T>> public C collectMany(C collector, Function<? super E, ? extends Collection<? extends T>> projection)

      Projects each item from a source array to a result collection and concatenates (flattens) the resulting collections adding them into the `collector`. A "fat-free" variant of Object accepting a Function.

           Integer[] nums = [1, 2, 3, 4, 5]
           def origPlusIncrements = nums.collectMany([] as Set, n -> [n, n + 1])
           assert origPlusIncrements.size() == nums.size() + 1

      Parameters:
        `collector` - an initial collection to add the projected items to
        `projection` - a projecting function returning a collection of items
      Returns:
        the collector with the projected collections concatenated (flattened) into it
      Since:
        6.0.0

    - #### public boolean contains(Object value)

      Checks whether the array contains the given value.

      Parameters:
        `value` - the value being searched for
      Returns:
        true if the array contains the value
      Since:
        1.8.6

    - #### public Number count(Object value)

      Counts the number of occurrences of the given value inside this array. Comparison is done using Groovy's == operator (using `compareTo(value) == 0` or `equals(value)` ).

      Parameters:
        `value` - the value being searched for
      Returns:
        the number of occurrences
      Since:
        1.6.4

    - #### <T> public Number count(Closure<?> predicate)

      Counts the number of occurrences which satisfy the given closure from inside this array.

      Parameters:
        `predicate` - a closure condition
      Returns:
        the number of occurrences
      Since:
        1.8.0

    - #### <T> public Number count(Predicate<? super T> predicate)

      Counts the number of array elements matching the given predicate. A "fat-free" variant of Object accepting a Predicate.

           Integer[] nums = [1, 2, 3, 4, 5]
           assert nums.count(n -> n % 2 == 0) == 2

      Parameters:
        `predicate` - the predicate evaluated against each element
      Returns:
        the number of elements matching the predicate
      Since:
        6.0.0

    - #### <K, E> public Map<K, Integer> countBy(Closure<K> closure)

      Sorts all array members into groups determined by the supplied mapping closure and counts the group size. The closure should return the key that each item should be grouped by. The returned Map will have an entry for each distinct key returned from the closure, with each value being the frequency of items occurring for that group.

      Example usage:

          assert ([1,2,2,2,3] as Object[]).countBy{ it % 2 } == [1:2, 0:3]

      Parameters:
        `closure` - a closure mapping items to the frequency keys
      Returns:
        a new Map grouped by keys with frequency counts
      See Also:
        DefaultGroovyMethods#countBy(Iterator, Closure)#countBy(Iterator, Closure)
      Since:
        1.8.0

    - #### <K, E> public Map<K, Integer> countBy(Function<? super E, ? extends K> function)

      Sorts all array members into groups determined by the supplied mapping function and counts the group size. A "fat-free" variant of Object accepting a Function.

           Integer[] nums = [1, 2, 3, 4, 5]
           assert [1: 3, 0: 2] == nums.countBy(n -> n % 2)

      Parameters:
        `function` - a function mapping items to the frequency keys
      Returns:
        a new Map grouped by keys with frequency counts
      Since:
        6.0.0

    - #### <E> public Map<E, Integer> countBy()

      Creates a multiset-like map of the array members.

      Example usage:

           assert [1:2, 2:2, 3:1] == ([1,2,1,2,3] as Object[]).countBy()

      Returns:
        a new Map where the keys are the set of values in the array and the values are the frequency counts
      Since:
        5.0.0

    - #### <T> public T[] drop(int num)

      Drops the given number of elements from the head of this array if they are available.

           String[] strings = [ 'a', 'b', 'c' ]
           assert strings.drop( 0 ) == [ 'a', 'b', 'c' ] as String[]
           assert strings.drop( 2 ) == [ 'c' ] as String[]
           assert strings.drop( 5 ) == [] as String[]

      Parameters:
        `num` - the number of elements to drop from this array
      Returns:
        An array consisting of all elements of this array except the first `num` ones, or else the empty array, if this array has less than `num` elements.
      Since:
        1.8.1

    - #### <T> public T[] dropRight(int num)

      Drops the given number of elements from the tail of this array if they are available.

           String[] strings = [ 'a', 'b', 'c' ]
           assert strings.dropRight( 0 ) == [ 'a', 'b', 'c' ] as String[]
           assert strings.dropRight( 2 ) == [ 'a' ] as String[]
           assert strings.dropRight( 5 ) == [] as String[]

      Parameters:
        `num` - the number of elements to drop from this array
      Returns:
        An array consisting of all elements of this array except the last `num` ones, or else the empty array, if this array has less than `num` elements.
      Since:
        2.4.0

    - #### <T> public T[] dropWhile(Closure<?> condition)

      Create a suffix of the given array by dropping as many elements as possible from the front of the original array such that calling the given closure condition evaluates to true when passed each of the dropped elements.

           def nums = [ 1, 3, 2 ] as Integer[]
           assert nums.dropWhile{ it <= 3 } == [ ] as Integer[]
           assert nums.dropWhile{ it < 3 } == [ 3, 2 ] as Integer[]
           assert nums.dropWhile{ it != 2 } == [ 2 ] as Integer[]
           assert nums.dropWhile{ it == 0 } == [ 1, 3, 2 ] as Integer[]

      Parameters:
        `condition` - the closure that must evaluate to true to continue dropping elements
      Returns:
        The shortest suffix of the given array such that the given closure condition evaluates to true for each element dropped from the front of the array.
      Since:
        1.8.7

    - #### <T> public T[] dropWhile(Predicate<? super T> condition)

      Returns a suffix of an array where elements are dropped from the front while the predicate is satisfied. A "fat-free" variant of Object accepting a Predicate.

           Integer[] nums = [1, 2, 3, 0, 4]
           assert nums.dropWhile(n -> n < 3).toList() == [3, 0, 4]

      Parameters:
        `condition` - the predicate that must evaluate to true to continue dropping elements
      Returns:
        the shortest suffix of the given array such that its first element does not pass the given predicate
      Since:
        6.0.0

    - #### <T> public T[] each(Closure<?> closure)

      Iterates through an array passing each array entry to the given closure.

           String[] letters = ['a', 'b', 'c']
           String result = ''
           letters.each{ result += it }
           assert result == 'abc'

      Parameters:
        `closure` - the closure applied on each array entry
      Returns:
        the self array
      Since:
        2.5.0

    - #### <T> public T[] each(Consumer<? super T> consumer)

      Iterates through an array, passing each element to the given consumer. A "fat-free" variant of Object accepting a Consumer.

           def result = []
           assert (['a', 'b', 'c'] as String[]).each(result::add).length == 3
           assert result == ['a', 'b', 'c']

      Parameters:
        `consumer` - the consumer applied on each element found
      Returns:
        the self array
      Since:
        6.0.0

    - #### <T> public T[] eachWithIndex(Closure<?> closure)

      Iterates through an array, passing each array element and the element's index (a counter starting at zero) to the given closure.

           String[] letters = ['a', 'b', 'c']
           String result = ''
           letters.eachWithIndex{ letter, index -> result += "$index:$letter" }
           assert result == '0:a1:b2:c'

      Parameters:
        `closure` - a Closure to operate on each array entry
      Returns:
        the self array
      Since:
        2.5.0

    - #### <T> public T[] eachWithIndex(ObjIntConsumer<? super T> consumer)

      Iterates through an array, passing each element and its index to the given consumer. A "fat-free" variant of Object accepting an ObjIntConsumer.

           def result = [:]
           (['a', 'b', 'c'] as String[]).eachWithIndex((item, index) -> result[index] = item)
           assert result == [0: 'a', 1: 'b', 2: 'c']

      Parameters:
        `consumer` - the consumer applied on each element and its index
      Returns:
        the self array
      Since:
        6.0.0

    - #### 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.
      Since:
        1.5.0

    - #### <T> public boolean every(Closure<?> predicate)

      Used to determine if the given predicate closure is valid (i.e. returns `true` for all items in this Array).

      Parameters:
        `predicate` - the closure predicate used for matching
      Returns:
        true if the predicate returns true for all elements in the array
      Since:
        2.5.0

    - #### <T> public boolean every(Predicate<? super T> predicate)

      Returns true if every element of the array matches the given predicate. A "fat-free" variant of Object accepting a Predicate.

           Integer[] nums = [2, 4, 6]
           assert nums.every(n -> n % 2 == 0)
           assert !nums.every(n -> n > 2)

      Parameters:
        `predicate` - the predicate evaluated against each element
      Returns:
        true if every element satisfies the predicate
      Since:
        6.0.0

    - #### <T> public T find(Closure<?> condition)

      Finds the first element in the array that matches the given closure condition. Example:

           def list = [1,2,3] as Integer[]
           assert 2 == list.find { it > 1 }
           assert null == list.find { it > 5 }

      Parameters:
        `condition` - a closure condition
      Returns:
        The first element from the array that matches the condition or null if no element matches.
      Since:
        2.0

    - #### <T> public T find(Predicate<? super T> condition)

      Finds the first element in the array that matches the given predicate, or null if none match. A "fat-free" variant of Object accepting a Predicate.

           Integer[] nums = [1, 2, 3, 4]
           assert nums.find(n -> n > 2) == 3
           assert nums.find(n -> n > 5) == null

      Parameters:
        `condition` - the predicate evaluated against each element
      Returns:
        the first element matching the predicate, in iteration order, or null if none matches
      Since:
        6.0.0

    - #### <T> public List<T> findAll()

      Finds the elements of the array matching the IDENTITY Closure (i.e. matching Groovy truth).

           def items = [1, 2, 0, false, true, '', 'foo', [], [4, 5], null] as Object[]
           assert items.findAll() == [1, 2, true, 'foo', [4, 5]]

      Returns:
        A list of the truthy values.
      See Also:
        Closure.IDENTITY
      Since:
        2.0

    - #### <T> public List<T> findAll(Closure<?> condition)

      Finds all elements of the array matching the given Closure condition.

           def items = [1,2,3,4] as Integer[]
           assert [2,4] == items.findAll { it % 2 == 0 }

      Parameters:
        `condition` - a closure condition
      Returns:
        A list of the matching values.
      Since:
        2.0

    - #### <T> public List<T> findAll(Predicate<? super T> condition)

      Finds all elements of the array matching the given predicate. A "fat-free" variant of Object accepting a Predicate.

           Integer[] nums = [1, 2, 3, 4, 5, 6]
           assert nums.findAll(n -> n % 2 == 0) == [2, 4, 6]

      Parameters:
        `condition` - the predicate evaluated against each element
      Returns:
        a list of the elements matching the predicate
      Since:
        6.0.0

    - #### <T> public int findIndexOf(Closure<?> condition)

      Iterates over the elements of an array and returns the index of the first item that satisfies the condition specified by the closure.

      Parameters:
        `condition` - the matching condition
      Returns:
        The index of the first matched object or -1 if no match was found.
      Since:
        2.5.0

    - #### <T> public int findIndexOf(int startIndex, Closure<?> condition)

      Iterates over the elements of an array, starting from a specified index, and returns the index of the first item that satisfies the condition specified by the closure.

      Parameters:
        `startIndex` - start matching from this index
        `condition` - the matching condition
      Returns:
        The index of the first matched object or -1 if no match was found.
      Since:
        2.5.0

    - #### <T> public List<Number> findIndexValues(Closure<?> condition)

      Iterates over the elements of an array and returns the index values of the items that match the condition specified in the closure.

      Parameters:
        `condition` - the matching condition
      Returns:
        a list of numbers corresponding to the index values of all matched objects
      Since:
        2.5.0

    - #### <T> public List<Number> findIndexValues(Number startIndex, Closure<?> condition)

      Iterates over the elements of an array, starting from a specified index, and returns the index values of the items that match the condition specified in the closure.

      Parameters:
        `startIndex` - start matching from this index
        `condition` - the matching condition
      Returns:
        a list of numbers corresponding to the index values of all matched objects
      Since:
        2.5.0

    - #### <T> public int findLastIndexOf(Closure<?> condition)

      Returns the index of the last item that matches the specified condition.

           def array = new Number[]{1, 2, 1, 2, 1}
           assert array.findLastIndexOf{it==1} ==  4
           assert array.findLastIndexOf{it==2} ==  3
           assert array.findLastIndexOf{it==3} == -1
           assert array.findLastIndexOf{it>=0} ==  4
           assert array.findLastIndexOf{it<=0} == -1
           def empty = new Object[0]
           assert empty.findLastIndexOf {true} == -1

      Parameters:
        `condition` - the matching condition
      Returns:
        The index of the last matched object or -1 if no match was found.
      Since:
        2.5.0

    - #### <T> public int findLastIndexOf(int lowerBound, Closure<?> condition)

      Returns the index of the last item that matches the specified condition that is at or beyond the given index.

           def array = new Number[]{3, 1, 2, 1, 2, 1}
           assert array.findLastIndexOf(1,{it==0}) == -1
           assert array.findLastIndexOf(1,{it==1}) ==  5
           assert array.findLastIndexOf(1,{it==2}) ==  4
           assert array.findLastIndexOf(1,{it==3}) == -1
           assert array.findLastIndexOf(0,{it==3}) ==  0
           def empty = new Object[0]
           assert empty.findLastIndexOf( 2,{true}) == -1
           assert empty.findLastIndexOf(-2,{true}) == -1

      Parameters:
        `lowerBound` - the minimum index
        `condition` - the matching condition
      Returns:
        The index of the last matched object or -1 if no match was found.
      Since:
        2.5.0

    - #### <T> public T findResult()

      Iterates through the Array stopping once the first non-null result is found and returning that result. If all results are null, null is returned.

      Returns:
        The first non-null result from calling the closure, or null.
      Since:
        4.0.9

    - #### <T, U extends T, V extends T> public T findResult(V defaultResult)

      Iterates through the Array stopping once the first non-null result is found and returning that result. If all are null, the defaultResult is returned.

      Parameters:
        `defaultResult` - an Object that should be returned if all elements are null
      Returns:
        the first non-null result from calling the closure, or the defaultValue
      Since:
        4.0.9

    - #### <S, T> public T findResult(Closure<T> condition)

      Iterates through the Array calling the given closure condition for each item but stopping once the first non-null result is found and returning that result. If all results are null, null is returned.

      Parameters:
        `condition` - a closure that returns a non-null value to indicate that processing should stop and the value should be returned
      Returns:
        The first non-null result from calling the closure, or null.
      Since:
        2.5.0

    - #### <S, T, U extends T, V extends T> public T findResult(U defaultResult, Closure<V> condition)

      Iterates through the Array calling the given closure condition for each item but stopping once the first non-null result is found and returning that result. If all are null, the defaultResult is returned.

      Parameters:
        `defaultResult` - a value that should be returned if all closure results are null
        `condition` - a closure that returns a non-null value to indicate that processing should stop and the value should be returned
      Returns:
        The first non-null result from calling the closure, or the defaultValue.
      Since:
        2.5.0

    - #### <T> public Collection<T> findResults()

      Iterates through the Array collecting any non-null results.

      Returns:
        The list of non-null values.
      Since:
        4.0.9

    - #### <T, U> public Collection<T> findResults(Closure<T> filteringTransform)

      Iterates through the Array transforming items using the supplied closure and collecting any non-null results.

      Parameters:
        `filteringTransform` - a closure that should return either a non-null transformed value or null for items which should be discarded
      Returns:
        The list of non-null transformed values.
      Since:
        2.5.0

    - #### <T> public T first()

      Returns the first item from the array.

           def array = [3, 4, 2].toArray()
           assert array.first() == 3

      throws:
        NoSuchElementException if the array is empty
      Returns:
        the first item from the array
      Since:
        1.7.3

    - #### public List<Object> flatten()

      Flattens an array. This array and any nested arrays or collections have their contents (recursively) added to the new collection.

      Returns:
        S flattened Collection
      Since:
        1.6.0

    - #### public Collection flattenMany(Closure<?> transform)

      Flatten an array. This array and any nested arrays, collections or optionals have their contents (recursively) added to a new collection. A transform is applied to any leaf nodes before further flattening.

      Parameters:
        `transform` - a transform applied to any leaf elements
      Returns:
        a flattened Collection
      Since:
        5.0.0

    - #### <T> public List<T> getAt(Range<?> range)

      Supports the subscript operator for an object array with a range giving the desired indices.

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

    - #### <T> public List<T> getAt(IntRange range)

      Supports the subscript operator for an object array with an IntRange giving the desired indices.

      Parameters:
        `range` - an IntRange
      Returns:
        a range of a list from the range's from index up to but not including the range's to value
      Since:
        1.0

    - #### <T> public List<T> getAt(ObjectRange range)

      Supports the subscript operator for an object array with an ObjectRange giving the desired indices.

      Parameters:
        `range` - an ObjectRange
      Returns:
        a range of a list from the range's from index up to but not including the range's to value
      Since:
        1.0

    - #### <T> public List<T> getAt(EmptyRange<?> range)

      Supports the subscript operator for an object array with an EmptyRange.

      Parameters:
        `range` - an EmptyRange
      Returns:
        an empty Range
      Since:
        1.5.0

    - #### <T> public List<T> getAt(Collection<?> indices)

      Selects a List of items from an array using a Collection to identify the indices to be selected.

      Parameters:
        `indices` - a collection of indices
      Returns:
        a new list of the values at the given indices
      Since:
        1.0

    - #### <T> public IntRange getIndices()

      Returns indices of the array.

      Example:

           String[] letters = ['a', 'b', 'c', 'd']
           assert 0..<4 == letters.indices

      Returns:
        an index range
      Since:
        2.4.0

    - #### <T> public List<T> grep()

      Iterates over the array returning each element that matches using the IDENTITY Closure as a filter - effectively returning all elements which satisfy Groovy truth.

      Example:

           def items = [1, 2, 0, false, true, '', 'foo', [], [4, 5], null] as Object[]
           assert items.grep() == [1, 2, true, 'foo', [4, 5]]

      Returns:
        a list of elements which satisfy Groovy truth
      See Also:
        Closure.IDENTITY
      Since:
        2.0

    - #### <T> public List<T> grep(Object filter)

      Iterates over the array of items and returns a collection of items that match the given filter - calling the DefaultGroovyMethods#isCase(Object,Object)#isCase(Object,Object) method used by switch statements. This method can be used with different kinds of filters like regular expressions, classes, ranges etc. Example:

           def items = ['a', 'b', 'aa', 'bc', 3, 4.5] as Object[]
           assert items.grep( ~/a+/ )  == ['a', 'aa']
           assert items.grep( ~/../ )  == ['aa', 'bc']
           assert items.grep( Number ) == [ 3, 4.5 ]
           assert items.grep{ it.toString().size() == 1 } == [ 'a', 'b', 3 ]

      Parameters:
        `filter` - the filter to perform on each element of the array (using the DefaultGroovyMethods#isCase(java.lang.Object, java.lang.Object) method)
      Returns:
        a list of objects which match the filter
      Since:
        2.0

    - #### public String groovyToString()

      Returns Groovy's list-like string representation for an Object array. This is used by Groovy's formatting infrastructure (e.g., GString interpolation, `println`, assert messages). By default, it delegates to FormatHelper#toArrayString(Object[])#toArrayString(Object[]).

      If disabled, e.g. via `-Dgroovy.extension.disable=groovyToString(Object[])`, the JDK's default array `toString()` is used instead. Alternatively, you have the option to provide a replacement extension method in an extension module to customize how arrays are displayed throughout Groovy.

      Returns:
        the string representation
      Since:
        6.0.0

    - #### <K, T> public Map<K, List<T>> groupBy(Closure<K> closure)

      Sorts all array members into groups determined by the supplied mapping closure. The closure should return the key that this item should be grouped by. The returned LinkedHashMap will have an entry for each distinct key returned from the closure, with each value being a list of items for that group.

      Example usage:

           Integer[] items = [1,2,3,4,5,6]
           assert [0:[2,4,6], 1:[1,3,5]] == items.groupBy { it % 2 }

      Parameters:
        `closure` - a closure mapping entries on keys
      Returns:
        A map grouped by keys.
      Since:
        2.2.0

    - #### <K, T> public Map<K, List<T>> groupBy(Function<? super T, ? extends K> function)

      Sorts all array members into groups determined by the supplied mapping function. A "fat-free" variant of Object accepting a Function.

           Integer[] nums = [1, 2, 3, 4, 5, 6]
           assert [1: [1, 3, 5], 0: [2, 4, 6]] == nums.groupBy(n -> n % 2)

      Parameters:
        `function` - a function mapping entries on keys
      Returns:
        a new Map grouped by keys
      Since:
        6.0.0

    - #### public Map groupBy(Object closures)

      Sorts all array members into (sub)groups determined by the supplied mapping closures as per the Iterable variant of this method.

      Parameters:
        `closures` - an array of closures, each mapping entries on keys
      Returns:
        A map grouped by keys on each criterion.
      Since:
        2.2.0

    - #### public Map groupBy(List<Closure<?>> closures)

      Sorts all array members into (sub)groups determined by the supplied mapping closures as per the list variant of this method.

      Parameters:
        `closures` - a list of closures, each mapping entries on keys
      Returns:
        A map grouped by keys on each criterion.
      Since:
        2.2.0

    - #### <T, K> public Map<K, List<T>> groupByMany(Function<? super T, ? extends Iterable<? extends K>> keyFn)

      Groups all array members into (sub)groups determined by the supplied key mapping closure. The closure should return a list of keys applicable to a member. The member will be grouped under each key from the list. Example usage finding the words with capital letters:

           String[] words = ['TO', 'be', 'Or', 'nOT', 'To', 'be']
           assert words.groupByMany(w -> w.toSet().grep(~'[A-Z]')) == [T:['TO', 'nOT', 'To'], O:['TO', 'Or', 'nOT']]

      If the lists of generated keys are all of size 1, the result will be the same as `groupBy` with a closure returning the value in the key list:

           String[] animals = ['cat', 'dog', 'bird', 'pony']
           assert animals.groupByMany(a -> [a.size()]) == animals.groupBy(String::size)

      Parameters:
        `keyFn` - a closure returning an Iterable of keys for each element
      Returns:
        a new Map from keys to lists of elements
      Since:
        6.0.0

    - #### <T, U, K> public Map<K, List<U>> groupByMany(Function<? super T, ? extends U> valueFn, Function<? super T, ? extends Iterable<? extends K>> keyFn)

      Groups all members from the array into (sub)groups determined by the supplied key mapping closure. The key mapping closure should return a list of keys applicable to a member. The value returned by mapping the member with the value mapping closure will be grouped under each key from the list.

      Parameters:
        `valueFn` - a closure which can transform each member before collecting
        `keyFn` - a closure returning an Iterable of keys for each member
      Returns:
        a new Map from keys to lists of elements
      Since:
        6.0.0

    - #### <T> public List<List<T>> groupConsecutive()

      Splits this array into a list of sublists, each a maximal run of adjacent elements considered equal (number-aware coercion).

           Integer[] nums = [1, 1, 2, 2, 2, 3, 1, 1]
           assert nums.groupConsecutive() == [[1, 1], [2, 2, 2], [3], [1, 1]]

      Returns:
        a list of the runs of adjacent equal elements
      See Also:
        DefaultGroovyMethods#groupConsecutive(Iterable)#groupConsecutive(Iterable)
      Since:
        6.0.0

    - #### <T, K> public List<List<T>> groupConsecutive(Function<? super T, ? extends K> keyFn)

      Splits this array into runs of adjacent elements whose key, as computed by the given function, is equal (number-aware coercion).

           String[] fruit = ['apple', 'avocado', 'banana', 'cherry', 'citrus', 'date']
           assert fruit.groupConsecutive{ it[0] } == [['apple', 'avocado'], ['banana'], ['cherry', 'citrus'], ['date']]

      Parameters:
        `keyFn` - extracts the grouping key for each element
      Returns:
        a list of the runs of adjacent key-equal elements
      See Also:
        DefaultGroovyMethods#groupConsecutive(Iterable, java.util.function.Function)
      Since:
        6.0.0

    - #### <T> public List<List<T>> groupConsecutive(BiPredicate<? super T, ? super T> sameRun)

      Splits this array into runs where the given predicate, applied to the current run's previous element and the next element, holds. Use this to opt out of the default number-aware equality.

           Number[] ns = [1, 1L, 1.0, 2, 2]
           assert ns.groupConsecutive{ a, b -> a.equals(b) } == [[1], [1L], [1.0], [2, 2]]

      Parameters:
        `sameRun` - tests whether the next element continues the current run
      Returns:
        a list of the runs
      See Also:
        DefaultGroovyMethods#groupConsecutive(Iterable, java.util.function.BiPredicate)
      Since:
        6.0.0

    - #### <T> public T head()

      Returns the first item from the Object array.

          def array = [3, 4, 2].toArray()
           assert array.head() == 3

      throws:
        NoSuchElementException if the array is empty
      Returns:
        the first item from the Object array
      Since:
        1.7.3

    - #### public int indexOf(Object object)

      Returns the index of the first occurrence of the specified element in the array. That is, the lowest index `i` such that `Objects.equals(array[i], object)` or -1 if there is no such index.

           String[] array = ['foo','bar','foo']
           assert array.indexOf('foo') ==  0
           assert array.indexOf('bar') ==  1
           assert array.indexOf('baz') == -1
           assert array.indexOf(12345) == -1

      Since:
        5.0.0

    - #### <T> public Map<Integer, T> indexed()

      Zips an object array with indices in (index, value) order starting from index 0.

      Example usage:

           String[] letters = 'A'..'C'
           assert [0: 'A', 1: 'B', 2: 'C'] == letters.indexed()

      See Also:
        indexed(Object[], int)
      Since:
        5.0.0

    - #### <T> public Map<Integer, T> indexed(int offset)

      Zips an object array with indices in (index, value) order starting from a given index.

      Example usage:

           String[] letters = 'A'..'C'
           assert [5: 'A', 6: 'B', 7: 'C'] == letters.indexed(5)
           assert ["1: A", "2: B", "3: C"] == letters.indexed(1).collect { idx, str -> "$idx: $str" }

      Parameters:
        `offset` - an index to start from
      Returns:
        a Map (since the keys/indices are unique) containing the elements from the iterable zipped with indices
      See Also:
        DefaultGroovyMethods#indexed(Iterable, int)#indexed(Iterable, int)
      Since:
        5.0.0

    - #### <T> public T[] init()

      Returns the items from the Object array excluding the last item.

               String[] strings = ["a", "b", "c"]
               def result = strings.init()
               assert result.length == 2
               assert strings.class.componentType == String

      throws:
        UnsupportedOperationException if the array is empty
      Returns:
        an array without its last element
      Since:
        2.4.0

    - #### <E extends T, T, V extends T> public T inject(Closure<V> closure)

      Iterates through the given array, passing the first two elements to the closure. The result is passed back (injected) to the closure along with the third element and so on until all array elements have been consumed.

           def array = new Number[] {1, 2, 3, 4}
           def value = array.inject { acc, val -> acc * val }
           assert value == 24

           array = new Object[] {['a','b'], ['b','c'], ['d','b']}
           value = array.inject { acc, val -> acc.intersect(val) }
           assert value == ['b']

           array = new String[] {'t', 'i', 'm'}
           value = array.inject { acc, val -> acc + val }
           assert value == 'tim'

      throws:
        NoSuchElementException if the array is empty
      Parameters:
        `closure` - a closure
      Returns:
        first value for single-element array or the result of the last closure call
      See Also:
        inject(Object[], Object, Closure)
      Since:
        1.8.7

    - #### <T> public T inject(BinaryOperator<T> operator)

      Iterates through the given array, passing the first two elements to the operator. The result is passed back (injected) to the operator along with the third element and so on until all array elements have been consumed. A "fat-free" variant of Object accepting a BinaryOperator.

           import java.util.function.BinaryOperator
           Number[] array = [1, 2, 3, 4]
           BinaryOperator<Number> mult = (acc, val) -> acc * val
           assert array.inject(mult) == 24

      throws:
        NoSuchElementException if the array is empty
      Parameters:
        `operator` - a binary operator combining the running result with each element
      Returns:
        first value for single-element array or the result of the last operator call
      Since:
        6.0.0

    - #### <E, T, U extends T, V extends T> public T inject(U initialValue, Closure<V> closure)

      Iterates through the given array, passing in the initial value and the first element to the closure. The result is sent back (injected) with the second element. The new result is injected back into the closure with the third element and so on until all elements have been consumed.

           def array = new Number[] {2, 3, 4}
           def value = array.inject(1) { acc, val -> acc * val }
           assert value == 24

           array = new Object[] {['a','b'], ['b','c'], ['d','b']}
           value = array.inject(['a','b','c']) { acc, val -> acc.intersect(val) }
           assert value == ['b']

           array = new String[] {'t', 'i', 'm'}
           value = array.inject("") { acc, val -> acc + val }
           assert value == 'tim'

      Parameters:
        `initialValue` - base value
        `closure` - a closure
      Returns:
        base value for empty array or the result of the last closure call
      Since:
        1.5.0

    - #### <E, U> public U inject(U initialValue, BiFunction<? super U, ? super E, ? extends U> function)

      Iterates through the given array, passing in the initial value and the first element to the function. The result is sent back (injected) with the second element and so on until all elements have been consumed. A "fat-free" variant of Object accepting a BiFunction.

           import java.util.function.BiFunction
           Number[] array = [2, 3, 4]
           BiFunction<Number, Number, Number> mult = (acc, val) -> acc * val
           assert array.inject(1, mult) == 24

      Parameters:
        `initialValue` - base value
        `function` - a function combining the running result with each element
      Returns:
        base value for empty array or the result of the last function call
      Since:
        6.0.0

    - #### <E extends T, T, V extends T> public List<T> injectAll(Closure<V> closure)

      Iterates through the given array, injecting values as per `inject` but returns the list of all calculated values instead of just the final result.

      Since:
        5.0.0

    - #### <T> public List<T> injectAll(BinaryOperator<T> operator)

      Iterates through the given array, injecting values as per `inject` but returns the list of all calculated values instead of just the final result. A "fat-free" variant of Object accepting a BinaryOperator.

           import java.util.function.BinaryOperator
           Integer[] nums = 1..5
           BinaryOperator<Integer> add = (a, b) -> a + b
           assert nums.injectAll(add) == [3, 6, 10, 15]

      throws:
        NoSuchElementException if the array is empty
      Parameters:
        `operator` - a binary operator combining the running result with each element
      Returns:
        the list of all calculated values
      Since:
        6.0.0

    - #### <E, T, U extends T, V extends T> public List<T> injectAll(U initialValue, Closure<V> closure)

      Iterates through the given array, injecting values as per `inject` but returns the list of all calculated values instead of just the final result.

           Integer[] nums = 1..5
           var prefixSum = nums.injectAll(0, Integer::sum)
           Arrays.parallelPrefix(nums, Integer::sum) // built-in JDK mutating method
           assert nums == prefixSum

      Since:
        5.0.0

    - #### <E, U> public List<U> injectAll(U initialValue, BiFunction<? super U, ? super E, ? extends U> function)

      Iterates through the given array, injecting values as per `inject` but returns the list of all calculated values instead of just the final result. A "fat-free" variant of Object accepting a BiFunction.

           import java.util.function.BiFunction
           Integer[] nums = [1, 2, 3]
           BiFunction<Integer, Integer, Integer> add = (a, b) -> a + b
           assert nums.injectAll(0, add) == [1, 3, 6]

      Parameters:
        `initialValue` - base value
        `function` - a function combining the running result with each element
      Returns:
        the list of all calculated values
      Since:
        6.0.0

    - #### <T> public boolean isSorted()

      Determines if the array is sorted in natural order using a NumberAwareComparator.

           Integer[] nums = [1, 2, 3]
           assert nums.isSorted()
           Integer[] unsorted = [3, 1, 2]
           assert !unsorted.isSorted()

      Returns:
        true if the array elements are sorted in non-descending order
      See Also:
        isSorted(Object[], Comparator)
      Since:
        6.0.0

    - #### <T> public boolean isSorted(Comparator<? super T> comparator)

      Determines if the array is sorted according to the given Comparator. This is efficient — it checks adjacent pairs in a single pass and short-circuits on the first out-of-order pair.

           String[] words = ["hello","Hey","hi"]
           assert words.isSorted(String.CASE_INSENSITIVE_ORDER)

      Parameters:
        `comparator` - a Comparator used for the comparison
      Returns:
        true if the array elements are sorted according to the comparator
      Since:
        6.0.0

    - #### <T> public boolean isSorted(Function<? super T, ?> keyExtractor)

      Determines if the array is sorted in non-descending order of the keys returned by the given key extractor. Keys are compared number-aware. For a custom ordering use Object (a two-arg closure coerces to a Comparator).

      Parameters:
        `keyExtractor` - extracts the sort key from each element
      Returns:
        true if the array elements are sorted by key in non-descending order
      See Also:
        isSorted(Object[], Comparator)
      Since:
        6.0.0

    - #### <T> public Iterator<T> iterator()

      Returns an Iterator which traverses the given array in index order.

      Returns:
        an Iterator backed by the given Array.
      See Also:
        ArrayIterator
      Since:
        1.6.4

    - #### public String join()

      Concatenates the string representation of each item in this array.

           def array = new Number[]{1,2L,3G}
           assert array.join() == "123"

      Returns:
        the joined String
      Since:
        5.0.0

    - #### public String join(String separator)

      Concatenates the string representation of each item in this array, with the given String as a separator between each item.

           Serializable[] array = [1,2L,-3G]
           assert array.join("+") == "1+2+-3"

      Parameters:
        `separator` - a String separator
      Returns:
        the joined String
      Since:
        1.0

    - #### <T> public T last()

      Returns the last item from the array.

           def array = [3, 4, 2].toArray()
           assert array.last() == 2

      throws:
        NoSuchElementException if you try to access last() for an empty array
      Returns:
        the last item from the array
      Since:
        1.7.3

    - #### public int lastIndexOf(Object object)

      Returns the index of the last occurrence of the specified element in the array. That is, the highest index `i` such that `Objects.equals(array[i], object)` or -1 if there is no such index.

           String[] array = ['foo','bar','foo']
           assert array.lastIndexOf('foo') ==  2
           assert array.lastIndexOf('bar') ==  1
           assert array.lastIndexOf('baz') == -1
           assert array.lastIndexOf(12345) == -1

      Since:
        5.0.0

    - #### <T> public T max()

      Adds max() method to Object arrays.

      Returns:
        the maximum value
      See Also:
        DefaultGroovyMethods#max(Iterator)#max(Iterator)
      Since:
        1.5.5

    - #### <T> public T max(Comparator<? super T> comparator)

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

      Parameters:
        `comparator` - a Comparator
      Returns:
        the maximum value
      See Also:
        DefaultGroovyMethods#max(Iterator, Comparator)#max(Iterator, Comparator)
      Since:
        1.5.5

    - #### <T> public T max(Closure<?> closure)

      Selects the maximum value found from the Object array using the closure to determine the correct ordering.

      If the closure has two parameters it is used like a traditional Comparator. I.e. it should compare its two parameters for order, returning a negative integer, zero, or a positive integer when the first parameter is less than, equal to, or greater than the second respectively. Otherwise, the Closure is assumed to take a single parameter and return a Comparable (typically an Integer) which is then used for further comparison.

      Parameters:
        `closure` - a Closure used to determine the correct ordering
      Returns:
        the maximum value
      Since:
        1.5.5

    - #### <T> public T min()

      Adds min() method to Object arrays.

      Returns:
        the minimum value
      See Also:
        DefaultGroovyMethods#min(Iterator)#min(Iterator)
      Since:
        1.5.5

    - #### <T> public T min(Comparator<? super T> comparator)

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

      Parameters:
        `comparator` - a Comparator
      Returns:
        the minimum value
      See Also:
        DefaultGroovyMethods#min(Iterator, java.util.Comparator)
      Since:
        1.5.5

    - #### <T> public T min(Closure<?> closure)

      Selects the minimum value found from the Object array using the closure to determine the correct ordering.

      If the closure has two parameters it is used like a traditional Comparator. I.e. it should compare its two parameters for order, returning a negative integer, zero, or a positive integer when the first parameter is less than, equal to, or greater than the second respectively. Otherwise, the Closure is assumed to take a single parameter and return a Comparable (typically an Integer) which is then used for further comparison.

      Parameters:
        `closure` - a Closure used to determine the correct ordering
      Returns:
        the minimum value
      See Also:
        DefaultGroovyMethods#min(Iterator, groovy.lang.Closure)
      Since:
        1.5.5

    - #### <T> public T[] minus(Iterable<?> removeMe)

      Creates a new array composed of the elements of the first array minus the elements of the given Iterable.

           Integer[] ints = [1, 2, 3, 1]
           List<Integer> nope = [1, 3]
           def result = ints - nope
           assert result.class == Integer[]
           assert result == new Integer[]{2}

           Integer[] none = []
           result = none - 123
           assert result !== none
           assert result.length == 0
           assert result.class == Integer[]

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

    - #### <T> public T[] minus(Object[] removeMe)

      Creates a new array composed of the elements of the first array minus the elements of the given array.

           Integer[] ints = [1, 2, 3, 1]
           Integer[] nope = [1, 3]
           def result = ints - nope
           assert result.class == Integer[]
           assert result == new Integer[]{2}

           Integer[] none = []
           result = none - 123
           assert result !== none
           assert result.length == 0
           assert result.class == Integer[]

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

    - #### <T> public T[] minus(Object removeMe)

      Creates a new array composed of the elements of the given array minus every occurrence the given object.

           Integer[] ints = [1, 2, 3, 1]
           def result = ints - 1
           assert result.class == Integer[]
           assert result == new Integer[]{2, 3}

           Integer[] none = []
           result = none - '1'
           assert result !== none
           assert result.length == 0
           assert result.class == Integer[]

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

    - #### <T> public int partitionPoint(IntRange range, Predicate<? super T> condition)

      Returns the index of the partition point according to the given predicate (the index of the first element of the second partition). The arr is assumed to be partitioned according to the given predicate.

           def arr = [7, 15, 3, 5, 4, 12, 6] as Integer[]
           assert arr.partitionPoint(0..<arr.size()) { it%2 != 0 } == 4

           def arr = [1, 2, 3, 3, 4, 4, 5, 6, 7] as Integer[]
           // usage case like lower_bound(cpp), bisect_left(python)
           assert arr.partitionPoint(0..<arr.size()) { it < 4 } == 4
           // usage case like upper_bound(cpp), bisect_right(python)
           assert arr.partitionPoint(0..<arr.size()) { it <= 4 } == 6
           // for all match condition
           assert arr.partitionPoint(0..<arr.size()) { it <= 100 } == arr.size()
           // for no match condition
           assert arr.partitionPoint(0..<arr.size()) { it <= 0 } == 0
           // for no match condition with range
           assert arr.partitionPoint(2..<arr.size()) { it <= 0 } == 2

      Parameters:
        `range` - the range [l,r] to find data match the condition
        `condition` - the matching condition
      Returns:
        an integer that is the index of the first element of the second partition
      Since:
        5.0.0

    - #### <T> public int partitionPoint(Predicate<? super T> condition)

      Returns the index of the partition point according to the given predicate (the index of the first element of the second partition). The arr is assumed to be partitioned according to the given predicate.

           def arr = [7, 15, 3, 5, 4, 12, 6] as Integer[]
           assert arr.partitionPoint{ it%2 != 0 } == 4

           def arr = [1, 2, 3, 3, 4, 4, 5, 6, 7] as Integer[]
           // usage case like lower_bound(cpp), bisect_left(python)
           assert arr.partitionPoint{ it < 4 } == 4
           // usage case like upper_bound(cpp), bisect_right(python)
           assert arr.partitionPoint{ it <= 4 } == 6
           // for all match condition
           assert arr.partitionPoint{ it <= 100 } == arr.size()
           // for no match condition
           assert arr.partitionPoint{ it <= 0 } == 0
           // empty input
           assert (new Integer[0]).partitionPoint{ it < 4 } == 0

      Parameters:
        `condition` - the matching condition
      Returns:
        an integer that is the index of the first element of the second partition
      Since:
        5.0.0

    - #### <T> public T[] plus(Collection<?> right)

      Creates an array containing elements from an original array plus those from a Collection.

           Integer[] a = [1, 2, 3]
           def result = a + [4, 5, 6]
           assert result.class == Integer[]
           assert result == new Integer[]{1, 2, 3, 4, 5, 6}

           Number[] c = [-1, 0.9, null]
           result = c + [1, 2, 3]
           assert result.class == Number[]
           assert result == new Number[]{-1, 0.9, null, 1, 2, 3}

           result = a + [-1, 0.9, null]
           assert result.class == Integer[]
           assert result == new Integer[]{1, 2, 3, -1, 0, null}

           // improper type arguments; Date can't be coerced to Integer
           groovy.test.GroovyAssert.shouldFail(ClassCastException) { a + [new Date()] }

      throws:
        ClassCastException if any elements from right aren't compatible (according to DefaultTypeTransformation#castToType(Object, Class)#castToType(Object, Class)) to the component type of left
      Parameters:
        `right` - a Collection to be appended
      Returns:
        A new array containing left with right appended to it.
      Since:
        1.8.7

    - #### <T> public T[] plus(Iterable<?> right)

      Creates an array containing elements from an original array plus those from an Iterable.

           class AbcIterable implements Iterable {
               Iterator iterator() { "abc".iterator() }
           }
           String[] array = ['x', 'y', 'z']
           def result = array + new AbcIterable()
           assert result.class == String[]
           assert result == new String[]{'x', 'y', 'z', 'a', 'b', 'c'}

      throws:
        ClassCastException if any elements from right aren't compatible (according to DefaultTypeTransformation#castToType(Object, Class)#castToType(Object, Class)) to the component type of left
      Parameters:
        `right` - an Iterable to be appended
      Returns:
        A new array containing elements from left with those from right appended.
      See Also:
        union(Object[], Iterable)
      Since:
        1.8.7

    - #### <T> public T[] plus(Object[] right)

      Creates an array as a union of two arrays.

           Integer[] a = [1, 2, 3]
           Integer[] b = [4, 5, 6]
           def result = a + b
           assert result.class == Integer[]
           assert result == new Integer[]{1, 2, 3, 4, 5, 6}

           Number[] c = [-1, 0.9, null]
           result = c + a
           assert result.class == Number[]
           assert result == new Number[]{-1, 0.9, null, 1, 2, 3}

           result = a + c
           assert result.class == Integer[]
           assert result == new Integer[]{1, 2, 3, -1, 0, null}

           Date[] d = [new Date()]
           // improper type arguments; Date can't be coerced to Integer
           groovy.test.GroovyAssert.shouldFail(ClassCastException) { a + d }

      throws:
        ClassCastException if any elements from right aren't compatible (according to DefaultTypeTransformation#castToType(Object, Class)#castToType(Object, Class)) to the component type of left
      Parameters:
        `right` - the right Array
      Returns:
        A new array containing right appended to left.
      Since:
        1.8.7

    - #### <T> public T[] plus(Object right)

      Creates an array containing elements from an original array plus an additional appended element.

           Integer[] a = [1, 2, 3]
           def result = a + 4
           assert result.class == Integer[]
           assert result == new Integer[]{1, 2, 3, 4}

           result = a + 5.5d
           assert result.class == Integer[]
           assert result == new Integer[]{1, 2, 3, 5}

           // improper type arguments; Date can't be coerced to Integer
           groovy.test.GroovyAssert.shouldFail(ClassCastException) { a + new Date() }

      throws:
        ClassCastException if any elements from right aren't compatible (according to DefaultTypeTransformation#castToType(Object, Class)#castToType(Object, Class)) to the component type of left
      Parameters:
        `right` - the value to append
      Returns:
        A new array containing left with right appended to it.
      Since:
        1.8.7

    - #### <T> public void putAt(IntRange range, T[] source)

      A helper method to allow arrays to be set with subscript operators.

           Integer[] from = [70, 80, 90]
           Integer[] nums = [1, 2, 3, 4, 5]
           nums[1..3] = from
           assert nums == [1, 70, 80, 90, 5]

      throws:
        IndexOutOfBoundsException if the source doesn't have sufficient elements or the IntRange is too big for the self array
      Parameters:
        `range` - the subset of the array to set
        `source` - the source array from which new values will come
      Since:
        5.0.0

    - #### <T> public void putAt(IntRange range, Iterable<T> source)

      A helper method to allow arrays to be set with subscript operators. Null will be used if the source iterable has insufficient elements.

           def from = [70, 80, 90]
           Integer[] nums = [1, 2, 3, 4, 5]
           nums[1..3] = from
           assert nums == [1, 70, 80, 90, 5]

      Parameters:
        `range` - the subset of the array to set
        `source` - the source array from which new values will come
      Since:
        5.0.0

    - #### <T> public T[] reverse()

      Creates a new array containing items which are the same as this array but in reverse order.

      Returns:
        An array containing the reversed items.
      See Also:
        reverse(Object[], boolean)
      Since:
        1.5.5

    - #### <T> public T[] reverse(boolean mutate)

      Reverses the items in an array. If mutate is true, the original array is modified in place and returned. Otherwise, a new array containing the reversed items is produced.

           def array = new Object[] {1,2,3}
           def yarra = array.reverse(true)
           assert array == 3..1
           assert yarra == 3..1

           yarra = array.reverse(false)
           assert array == 3..1
           assert yarra == 1..3

      Parameters:
        `mutate` - `true` if the array itself should be reversed in place, `false` if a new array should be created
      Returns:
        An array containing the reversed items.
      Since:
        1.8.1

    - #### <T> public T[] reverseEach(Closure<?> closure)

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

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

    - #### <T> public void shuffle()

      Randomly reorders the elements of the specified array.

           Integer[] array = [10, 5, 20]
           def origSize = array.size()
           def items = array.toList()
           array.shuffle()
           assert array.size() == origSize
           assert items.every{ array.contains(it) }

      Since:
        3.0.0

    - #### <T> public void shuffle(Random rnd)

      Randomly reorders the elements of the specified array using the specified random instance as the source of randomness.

           def r = new Random()
           Integer[] array = [10, 5, 20]
           def origSize = array.size()
           def items = array.toList()
           array.shuffle(r)
           assert array.size() == origSize
           assert items.every{ array.contains(it) }

      Since:
        3.0.0

    - #### <T> public T[] shuffled()

      Creates a new array containing the elements of the specified array but in a random order.

           Integer[] array = [10, 5, 20]
           def result = array.shuffled()
           assert array !== result
           assert array.length == result.length
           assert array.every{ result.contains(it) }
           assert array == new Integer[] {10, 5, 20}

      Returns:
        the shuffled array
      Since:
        3.0.0

    - #### <T> public T[] shuffled(Random rnd)

      Creates a new array containing the elements of the specified array but in a random order using the specified random instance as the source of randomness.

           def r = new Random()
           Integer[] array = [10, 5, 20]
           def result = array.shuffled(r)
           assert array !== result
           assert array.length == result.length
           assert array.every{ result.contains(it) }
           assert array == new Integer[] {10, 5, 20}

      Returns:
        the shuffled array
      Since:
        3.0.0

    - #### public int size()

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

      Returns:
        the length of the array
      Since:
        1.0

    - #### <T> public T[] sort()

      Modifies this array so that its elements are in sorted order. The array items are assumed to be comparable.

      Returns:
        the sorted array
      Since:
        1.5.5

    - #### <T> public T[] sort(boolean mutate)

      Sorts the given array into sorted order. The array items are assumed to be comparable. If mutate is true, the array is sorted in place and returned. Otherwise, a new sorted array is returned and the original array remains unchanged.

           def orig = ["hello","hi","Hey"] as String[]
           def sorted = orig.sort(false)
           assert orig == ["hello","hi","Hey"] as String[]
           assert sorted == ["Hey","hello","hi"] as String[]
           orig.sort(true)
           assert orig == ["Hey","hello","hi"] as String[]

      Parameters:
        `mutate` - false will always cause a new array to be created, true will mutate the array in place
      Returns:
        the sorted array
      Since:
        1.8.1

    - #### <T> public T[] sort(Comparator<? super T> comparator)

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

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

    - #### <T> public T[] sort(boolean mutate, Comparator<? super T> comparator)

      Sorts the elements from this array into sorted order as determined by the given comparator. If mutate is true, the array is sorted in place and returned. Otherwise, a new sorted array is returned and the original array remains unchanged.

           def orig = ["hello","hi","Hey"] as String[]
           def sorted = orig.sort(false, String.CASE_INSENSITIVE_ORDER)
           assert orig == ["hello","hi","Hey"] as String[]
           assert sorted == ["hello","Hey","hi"] as String[]
           orig.sort(true, String.CASE_INSENSITIVE_ORDER)
           assert orig == ["hello","Hey","hi"] as String[]

      Parameters:
        `mutate` - false will always cause a new array to be created, true will mutate arrays in place
        `comparator` - a Comparator used for the comparison
      Returns:
        a sorted array
      Since:
        1.8.1

    - #### <T> public T[] sort(Closure<?> closure)

      Sorts the elements from this array into a newly created array using the Closure to determine the correct ordering.

      If the closure has two parameters it is used like a traditional Comparator. I.e. it should compare its two parameters for order, returning a negative integer, zero, or a positive integer when the first parameter is less than, equal to, or greater than the second respectively. Otherwise, the Closure is assumed to take a single parameter and return a Comparable (typically an Integer) which is then used for further comparison.

      Parameters:
        `closure` - a Closure used to determine the correct ordering
      Returns:
        the sorted array
      Since:
        1.5.5

    - #### <T> public T[] sort(IntRange range, Closure<?> closure)

      Sorts the elements from this array with index values in the given index range into a newly created array using the Closure to determine the correct ordering.

      If the closure has two parameters it is used like a traditional Comparator. I.e. it should compare its two parameters for order, returning a negative integer, zero, or a positive integer when the first parameter is less than, equal to, or greater than the second respectively. Otherwise, the Closure is assumed to take a single parameter and return a Comparable (typically an Integer) which is then used for further comparison.

      Parameters:
        `closure` - a Closure used to determine the correct ordering
      Returns:
        the sorted array
      Since:
        5.0.0

    - #### <T> public T[] sort(boolean mutate, Closure<?> closure)

      Sorts the elements from this array into sorted order using the Closure to determine the correct ordering. If mutate is false, a new array is returned and the original array remains unchanged. Otherwise, the original array is sorted in place and returned.

      If the closure has two parameters it is used like a traditional Comparator. I.e. it should compare its two parameters for order, returning a negative integer, zero, or a positive integer when the first parameter is less than, equal to, or greater than the second respectively. Otherwise, the Closure is assumed to take a single parameter and return a Comparable (typically an Integer) which is then used for further comparison.

           def orig = ["hello","hi","Hey"] as String[]
           def sorted = orig.sort(false) { it.size() }
           assert orig == ["hello","hi","Hey"] as String[]
           assert sorted == ["hi","Hey","hello"] as String[]
           orig.sort(true) { it.size() }
           assert orig == ["hi","Hey","hello"] as String[]

      Parameters:
        `mutate` - false causes a new array to be created, true will mutate arrays in place
        `closure` - a Closure used to determine the correct ordering
      Returns:
        the sorted array
      Since:
        1.8.1

    - #### <T> public T[] sort(IntRange range, boolean mutate, Closure<?> closure)

      Sorts the elements with index values in the given index range into sorted order using the Closure to determine the correct ordering. If mutate is false, a new array is returned and the original array remains unchanged. Otherwise, the original array is sorted in place and returned.

      If the closure has two parameters it is used like a traditional Comparator. I.e. it should compare its two parameters for order, returning a negative integer, zero, or a positive integer when the first parameter is less than, equal to, or greater than the second respectively. Otherwise, the Closure is assumed to take a single parameter and return a Comparable (typically an Integer) which is then used for further comparison.

           // an array with some odd then even numbers
           Integer[] nums = [5, 9, 1, 7, 3, 4, 8, 6, 0, 2]

           // sort odds ascending, evens descending
           assert nums.sort(0..4, false) { it }.sort(5..9, false) { -it }
            == [1, 3, 5, 7, 9, 8, 6, 4, 2, 0]
           // sort odds descending, evens descending
           assert nums.sort(0..<5, false) { -it }.sort(4<..<10, false) { -it }
            == [9, 7, 5, 3, 1, 8, 6, 4, 2, 0]
           // sort odds descending, evens ascending
           assert nums.sort(0..<5, false) { -it }.sort(5..-1, false) { it }
            == [9, 7, 5, 3, 1, 0, 2, 4, 6, 8]
           // leave first and last numbers, sort remaining odds ascending, remaining evens descending
           assert nums.sort(1..4, false) { it }.sort(5..-2, false) { -it }
            == [5, 1, 3, 7, 9, 8, 6, 4, 0, 2]
           // leave first and last numbers, sort remaining odds descending, remaining evens ascending
           assert nums.sort(1..4, false) { -it }.sort(5..-2, false) { it }
            == [5, 9, 7, 3, 1, 0, 4, 6, 8, 2]
           // leave first and last odds and evens, sort remaining odds ascending, remaining evens descending
           assert nums.sort(0<..<4, false) { it }.sort(5<..<9, false) { -it }
            == [5, 1, 7, 9, 3, 4, 8, 6, 0, 2]
           // leave first and last odds and evens, sort remaining odds descending, remaining evens ascending
           assert nums.sort(0<..<4, false) { -it }.sort(5<..<-1, false) { it }
            == [5, 9, 7, 1, 3, 4, 0, 6, 8, 2]

      Parameters:
        `range` - the inclusive range of index values over which to sort
        `mutate` - false causes a new array to be created, true will mutate arrays in place
        `closure` - a Closure used to determine the correct ordering
      Returns:
        the sorted array
      Since:
        5.0.0

    - #### <T> public Collection<Collection<T>> split(Closure<?> closure)

      Splits all items into two collections based on the closure condition. The first list contains all items which match the closure expression. The second list all those that don't.

      Parameters:
        `closure` - a closure condition
      Returns:
        a List whose first item is the accepted values and whose second item is the rejected values
      Since:
        2.5.0

    - #### <T> public Collection<Collection<T>> split(Predicate<? super T> predicate)

      Splits all array items into two collections based on the predicate. A "fat-free" variant of Object accepting a Predicate.

           Integer[] nums = [1, 2, 3, 4]
           assert [[2, 4], [1, 3]] == nums.split(n -> n % 2 == 0)

      Parameters:
        `predicate` - a predicate used to determine the target collection
      Returns:
        a List whose first item is the accepted values and whose second item is the rejected values
      Since:
        6.0.0

    - #### <T> public Stream<T> stream()

      Returns a sequential Stream with the specified array as its source.

      Parameters:
        `self` - The array, assumed to be unmodified during use
      Returns:
        a `Stream` for the array
      Since:
        2.5.0

    - #### public Object sum()

      Sums the items in an array. This is equivalent to invoking the "plus" method on all items in the array.

      Returns:
        The sum of all the items
      See Also:
        DefaultGroovyMethods#sum(java.util.Iterator)
      Since:
        1.7.1

    - #### public Object sum(Object initialValue)

      Sums the items in an array, adding the result to some initial value.

      Parameters:
        `initialValue` - the items in the array will be summed to this initial value
      Returns:
        The sum of all the items.
      Since:
        1.7.1

    - #### <T> public Object sum(Closure<?> closure)

      Sums the result of applying a closure to each item of an array. `array.sum(closure)` is equivalent to: `array.collect(closure).sum()`.

      Parameters:
        `closure` - a single parameter closure that returns a (typically) numeric value.
      Returns:
        The sum of the values returned by applying the closure to each item of the array.
      Since:
        1.7.1

    - #### <T> public Object sum(Object initialValue, Closure<?> closure)

      Sums the result of applying a closure to each item of an array to some initial value. `array.sum(initVal, closure)` is equivalent to: `array.collect(closure).sum(initVal)`.

      Parameters:
        `closure` - a single parameter closure that returns a (typically) numeric value.
        `initialValue` - the closure results will be summed to this initial value
      Returns:
        The sum of the values returned by applying the closure to each item of the array.
      Since:
        1.7.1

    - #### <T> public T[] swap(int i, int j)

      Swaps two elements at the specified positions.

      Example:

           assert (["a", "c", "b", "d"] as String[]) == (["a", "b", "c", "d"] as String[]).swap(1, 2)

      Parameters:
        `i` - a position
        `j` - a position
      Returns:
        self
      Since:
        2.4.0

    - #### <T> public T[] tail()

      Returns the items from the array excluding the first item.

           String[] strings = ["a", "b", "c"]
           def result = strings.tail()
           assert result.class.componentType == String
           String[] expected = ["b", "c"]
           assert result == expected

      throws:
        UnsupportedOperationException if the array is empty
      Returns:
        an array without its first element
      Since:
        1.7.3

    - #### <T> public T[] take(int num)

      Returns the first `num` elements from the head of this array.

           String[] strings = [ 'a', 'b', 'c' ]
           assert strings.take( 0 ) == [] as String[]
           assert strings.take( 2 ) == [ 'a', 'b' ] as String[]
           assert strings.take( 5 ) == [ 'a', 'b', 'c' ] as String[]

      Parameters:
        `num` - the number of elements to take from this array
      Returns:
        an array consisting of the first `num` elements of this array, or else the whole array if it has less than `num` elements.
      Since:
        1.8.1

    - #### <T> public T[] takeRight(int num)

      Returns the last `num` elements from the tail of this array.

           String[] strings = [ 'a', 'b', 'c' ]
           assert strings.takeRight( 0 ) == [] as String[]
           assert strings.takeRight( 2 ) == [ 'b', 'c' ] as String[]
           assert strings.takeRight( 5 ) == [ 'a', 'b', 'c' ] as String[]

      Parameters:
        `num` - the number of elements to take from this array
      Returns:
        an array consisting of the last `num` elements of this array, or else the whole array if it has less than `num` elements.
      Since:
        2.4.0

    - #### <T> public T[] takeWhile(Closure<?> condition)

      Returns the longest prefix of this array where each element passed to the given closure evaluates to true.

           def nums = [ 1, 3, 2 ] as Integer[]
           assert nums.takeWhile{ it < 1 } == [] as Integer[]
           assert nums.takeWhile{ it < 3 } == [ 1 ] as Integer[]
           assert nums.takeWhile{ it < 4 } == [ 1, 3, 2 ] as Integer[]

      Parameters:
        `condition` - the closure that must evaluate to true to continue taking elements
      Returns:
        A prefix of the given array where each element passed to the given closure evaluates to true.
      Since:
        1.8.7

    - #### <T> public T[] takeWhile(Predicate<? super T> condition)

      Returns the longest prefix of an array where each element passes the given predicate. A "fat-free" variant of Object accepting a Predicate.

           Integer[] nums = [1, 2, 3, 0, 4]
           assert nums.takeWhile(n -> n < 3).toList() == [1, 2]

      Parameters:
        `condition` - the predicate that must evaluate to true to continue taking elements
      Returns:
        a prefix of the given array where each element passes the given predicate
      Since:
        6.0.0

    - #### <T> public List<T> toImmutableList()

      Converts this array to an immutable List of the same size, with each element added to the list. Null elements are preserved (unlike List.of, which rejects nulls). The returned list is unmodifiable; mutation attempts throw UnsupportedOperationException. Returns the canonical empty list (Collections.emptyList) when the array is empty.

           import static groovy.test.GroovyAssert.shouldFail
           String[] arr = ['a', null, 'b']
           def list = arr.toImmutableList()
           assert list == ['a', null, 'b']
           shouldFail(UnsupportedOperationException) { list << 'c' }
           assert (new String[0]).toImmutableList() === Collections.emptyList()

      Returns:
        An immutable list containing the contents of this array.
      Since:
        6.0.0

    - #### <T> public Set<T> toImmutableSet()

      Converts this array to an immutable Set, with each unique element added to the set. Null elements are preserved (unlike Set#copyOf(java.util.Collection), which rejects nulls). The returned set is unmodifiable; mutation attempts throw UnsupportedOperationException. Returns the canonical empty set (Collections.emptySet) when the array is empty.

           import static groovy.test.GroovyAssert.shouldFail
           String[] arr = ['a', null, 'b', 'a']
           def set = arr.toImmutableSet()
           assert set == ['a', null, 'b'] as Set
           shouldFail(UnsupportedOperationException) { set << 'c' }
           assert (new String[0]).toImmutableSet() === Collections.emptySet()

      Returns:
        An immutable set containing the unique contents of this array.
      Since:
        6.0.0

    - #### <T> public List<T> toList()

      Converts this array to a List of the same size, with each element added to the list.

      Returns:
        A mutable list containing the contents of this array.
      Since:
        1.0

    - #### <T> public Set<T> toSet()

      Converts this array to a Set, with each unique element added to the set.

      Returns:
        A set containing the unique contents of this array.
      Since:
        5.0.0

    - #### <T> public T[] toSorted()

      Returns a sorted version of the given array using the supplied comparator.

      Returns:
        the sorted array
      See Also:
        toSorted(Object[], Comparator)
      Since:
        2.4.0

    - #### <T> public T[] toSorted(Comparator<? super T> comparator)

      Returns a sorted version of the given array using the supplied comparator to determine the resulting order.

           def sumDigitsComparator = [compare: { num1, num2 -> num1.toString().toList()*.toInteger().sum() <=> num2.toString().toList()*.toInteger().sum() }] as Comparator
           Integer[] nums = [9, 44, 222, 7000]
           def result = nums.toSorted(sumDigitsComparator)
           assert result instanceof Integer[]
           assert result == [222, 7000, 44, 9]

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

    - #### <T> public T[] toSorted(Closure<?> closure)

      Sorts the elements from this array into a newly created array using the Closure to determine the correct ordering.

      If the closure has two parameters it is used like a traditional Comparator. I.e. it should compare its two parameters for order, returning a negative integer, zero, or a positive integer when the first parameter is less than, equal to, or greater than the second respectively. Otherwise, the Closure is assumed to take a single parameter and return a Comparable (typically an Integer) which is then used for further comparison.

      Parameters:
        `closure` - a Closure used to determine the correct ordering
      Returns:
        a sorted array
      See Also:
        toSorted(Object[], Comparator)
      Since:
        2.4.0

    - #### public SpreadMap toSpreadMap()

      Creates a spreadable map from this array.

      Returns:
        a newly created SpreadMap
      See Also:
        SpreadMap.SpreadMap
      Since:
        1.0

    - #### public String toString()

      Returns the string representation of the given array.

      Returns:
        the string representation
      Since:
        1.0

    - #### <T> public T[] toUnique()

      Returns a new Array containing the items from the original Array but with duplicates removed using the natural ordering of the items in the array.

           String[] letters = ['c', 'a', 't', 's', 'a', 't', 'h', 'a', 't']
           String[] expected = ['c', 'a', 't', 's', 'h']
           def result = letters.toUnique()
           assert result == expected
           assert result.class.componentType == String

      Returns:
        the unique items from the array
      Since:
        2.4.0

    - #### <T> public T[] toUnique(Comparator<? super T> comparator)

      Returns a new Array containing the items from the original Array but with duplicates removed with the supplied comparator determining which items are unique.

           String[] letters = ['c', 'a', 't', 's', 'A', 't', 'h', 'a', 'T']
           String[] lower = ['c', 'a', 't', 's', 'h']
           class LowerComparator implements Comparator {
               int compare(a, b) { a.toLowerCase() <=> b.toLowerCase() }
           }
           assert letters.toUnique(new LowerComparator()) == lower

      Parameters:
        `comparator` - a Comparator used to determine unique (equal) items If `null`, the Comparable natural ordering of the elements will be used.
      Returns:
        the unique items from the array
      Since:
        2.4.0

    - #### <T> public T[] toUnique(Closure<?> closure)

      Returns a new Array containing the items from the original Array but with duplicates removed with the supplied closure determining which items are unique.

           String[] letters = ['c', 'a', 't', 's', 'A', 't', 'h', 'a', 'T']
           String[] expected = ['c', 'a', 't', 's', 'h']
           assert letters.toUnique{ p1, p2 -> p1.toLowerCase() <=> p2.toLowerCase() } == expected
           assert letters.toUnique{ it.toLowerCase() } == expected

      Parameters:
        `closure` - a Closure used to determine unique items
      Returns:
        the unique items from the array
      Since:
        2.4.0

    - #### public Object[] union(Collection<?> right)

      Creates an object array containing elements from an original array plus those from a Collection. This is similar to Object but always return an Object array and so might be more applicable when adding heterogeneous arrays.

           Integer[] a = [1, 2, 3]
           def result = a.union(['foo', 'bar'])
           assert result.class == Object[]
           assert result == new Object[]{1, 2, 3, 'foo', 'bar'}

      Parameters:
        `right` - a Collection to be appended
      Returns:
        A new Object array containing left with right appended to it.
      Since:
        4.0.0

    - #### public Object[] union(Iterable<?> right)

      Creates an Object array containing elements from an original array plus those from an Iterable. This is similar to Object but always return an Object array and so might be more applicable when adding heterogeneous arrays.

           class AbcIterable implements Iterable {
               Iterator iterator() { "abc".iterator() }
           }
           String[] array = ['x', 'y', 'z']
           def result = array.union(new AbcIterable())
           assert result.class == Object[]
           assert result == new Object[]{'x', 'y', 'z', 'a', 'b', 'c'}

      Parameters:
        `right` - an Iterable to be appended
      Returns:
        A new Object array containing elements from left with those from right appended.
      Since:
        4.0.0

    - #### public Object[] union(Object[] right)

      Creates an Object array as a union of two arrays. This is similar to Object but always return an Object array and so might be more applicable when adding heterogeneous arrays.

           Integer[] a = [1, 2, 3]
           String[] b = ['foo', 'bar']
           def result = a.union(b)
           assert result.class == Object[]
           assert result == new Object[]{1, 2, 3, 'foo', 'bar'}

      Parameters:
        `right` - the right Array
      Returns:
        A new Object array containing right appended to left.
      Since:
        4.0.0

    - #### public Object[] union(Object right)

      Creates an Object array containing elements from an original array plus an additional appended element. This is similar to Object but always return an Object array and so might be more applicable when adding heterogeneous arrays.

           Integer[] a = [1, 2, 3]
           def result = a.union('foo')
           assert result.class == Object[]
           assert result == new Object[]{1, 2, 3, 'foo'}

      Parameters:
        `right` - the value to append
      Returns:
        A new Object array containing left with right appended to it.
      Since:
        4.0.0

    - #### <K, V> public Map<K, V> withCollectedKeys(Function<? super V, K> keyTransform)

      A variant of withCollectedKeys for arrays.

      Parameters:
        `keyTransform` - a function for transforming array elements into values
      Returns:
        the collector with all transformed values added to it
      See Also:
        DefaultGroovyMethods#withCollectedKeys(Iterable, Function)#withCollectedKeys(Iterable, Function)
      Since:
        5.0.0

    - #### <K, V> public Map<K, V> withCollectedKeys(Map<K, V> collector, Function<? super V, K> keyTransform)

      A variant of withCollectedKeys for arrays.

      Parameters:
        `collector` - the Map into which the transformed entries are put
        `keyTransform` - a function for transforming array elements into values
      Returns:
        the collector with all transformed values added to it
      See Also:
        DefaultGroovyMethods#withCollectedKeys(Iterable, Map, Function)#withCollectedKeys(Iterable, Map, Function)
      Since:
        5.0.0

    - #### <K, V> public Map<K, V> withCollectedValues(Function<? super K, V> valueTransform)

      A variant of withCollectedValues for arrays.

      Parameters:
        `valueTransform` - a function for transforming array elements into values
      Returns:
        A map of the transformed entries.
      Since:
        5.0.0

    - #### <K, V> public Map<K, V> withCollectedValues(Map<K, V> collector, Function<? super K, V> valueTransform)

      A variant of withCollectedValues for arrays.

      Parameters:
        `collector` - the Map into which the transformed entries are put
        `valueTransform` - a function for transforming array elements into values
      Returns:
        The collector with all transformed values added to it.
      Since:
        5.0.0

    - #### <T> public List<Tuple2<T, Integer>> withIndex()

      Zips an object array with indices in (value, index) order.

      Example usage:

           String[] letters = ['a', 'z']
           assert [['a', 0], ['z', 1]] == letters.withIndex()

      Returns:
        a zipped list with indices
      See Also:
        DefaultGroovyMethods#withIndex(Iterable)#withIndex(Iterable)
      Since:
        5.0.0

    - #### <T> public List<Tuple2<T, Integer>> withIndex(int offset)

      Zips an object array with indices in (value, index) order starting from a given index.

      Example usage:

           String[] letters = ['a', 'z']
           assert [['a', 5], ['z', 6]] == letters.withIndex(5)
           assert ["5: a", "6: z"] == letters.withIndex(5).collect { n, idx -> "$idx: $n" }

      Parameters:
        `offset` - an index to start from
      Returns:
        a zipped list with indices
      See Also:
        DefaultGroovyMethods#withIndex(Iterable, int)#withIndex(Iterable, int)
      Since:
        5.0.0

    - #### <T> public List<Tuple2<T, T>> zipWithNext()

      Returns a list of all the successive adjacent pairs from this array (a sliding window of size 2, step 1).

           Integer[] nums = [1, 2, 3, 4]
           assert nums.zipWithNext() == [[1, 2], [2, 3], [3, 4]]

      Returns:
        a list of the adjacent pairs
      See Also:
        DefaultGroovyMethods#zipWithNext(Iterable)#zipWithNext(Iterable)
      Since:
        6.0.0

    - #### <T, R> public List<R> zipWithNext(BiFunction<? super T, ? super T, ? extends R> combiner)

      Applies the combiner to each successive adjacent pair from this array, returning the list of results.

           Integer[] nums = [1, 2, 3, 4]
           assert nums.zipWithNext{ a, b -> b - a } == [1, 1, 1]
           String[] letters = ['a', 'b', 'c', 'd']
           assert letters.zipWithNext{ a, b -> a + b } == ['ab', 'bc', 'cd']

      Parameters:
        `combiner` - a function applied to each adjacent pair
      Returns:
        a list of the combined adjacent pairs
      See Also:
        DefaultGroovyMethods#zipWithNext(Iterable, java.util.function.BiFunction)
      Since:
        6.0.0