float[] (Groovy JDK enhancements)

Package:

## Class float[]

- - ### Methods Summary

    Methods
    Return type | Name and parameters
    --- | ---
    `boolean` | `any(Closure predicate)` Iterates over the contents of a float Array, and checks whether a predicate is valid for at least one element.
    `boolean` | `asBoolean()` Coerces a float array to a boolean value.
    `double` | `average()` Calculates the average of the floats in the array.
    `List` | `chop(int chopSizes)` Chops the float array into pieces, returning lists with sizes corresponding to the supplied chop sizes.
    `boolean` | `contains(Object value)` Checks whether the array contains the given value.
    `Number` | `count(Object value)` Counts the number of occurrences of the given value inside this array.
    `float[]` | `each(Consumer consumer)` Iterates through a float[] passing each float to the given consumer.
    `float[]` | `eachWithIndex(Closure closure)` Iterates through a float[], passing each float and the element's index (a counter starting at zero) to the given closure.
    `boolean` | `equals(float[] right)` Compares the contents of this array to the contents of the given array.
    `boolean` | `every(Closure predicate)` Iterates over the contents of a float Array, and checks whether a predicate is valid for all elements.
    `float` | `first()` Returns the first item from the float array.
    `List` | `flatten()` Flattens an array.
    `List` | `getAt(IntRange range)` Supports the subscript operator for a float array with an IntRange giving the desired indices.
    `List` | `getAt(ObjectRange range)` Supports the subscript operator for a float array with an ObjectRange giving the desired indices.
    `List` | `getAt(Range range)` Supports the subscript operator for a float array with a range giving the desired indices.
    `List` | `getAt(Collection indices)` Supports the subscript operator for a float array with a (potentially nested) collection giving the desired indices.
    `IntRange` | `getIndices()` Returns indices of the float array.
    `float` | `head()` Returns the first item from the float array.
    `Map` | `indexed()` Zips a float[] with indices in (index, value) order starting from index 0.
    `Map` | `indexed(int offset)` Zips a float[] with indices in (index, value) order starting from a given index.
    `float[]` | `init()` Returns the items from the float array excluding the last item.
    `String` | `join()` Concatenates the string representation of each item in this array.
    `String` | `join(String separator)` Concatenates the string representation of each item in this array, with the given String as a separator between each item.
    `float` | `last()` Returns the last item from the float array.
    `float` | `max()` Adds max() method to float arrays.
    `float` | `max(FloatComparator comparator)` Selects the maximum value found from the float array using the supplied FloatComparator to determine the maximum of any two values.
    `float` | `max(FloatUnaryOperator operator)` Selects the maximum value found from the float array using the supplied FloatUnaryOperator to determine the maximum of any two values.
    `float` | `maxComparing(Comparator comparator)` Selects the maximum value found from the float array using the comparator to determine the maximum of any two values.
    `float` | `min()` Adds min() method to float arrays.
    `float` | `min(FloatComparator comparator)` Selects the minimum value found from the float array using the supplied FloatComparator to determine the minimum of any two values.
    `float` | `min(FloatUnaryOperator operator)` Selects the minimum value found from the float array using the supplied FloatUnaryOperator to determine the minimum of any two values.
    `float` | `minComparing(Comparator comparator)` Selects the minimum value found from the float array using the comparator to determine the minimum of any two values.
    `int` | `partitionPoint(IntRange range, DoublePredicate condition)` Returns the index of the partition point according to the given predicate (the index of the first element of the second partition).
    `int` | `partitionPoint(DoublePredicate condition)` Returns the index of the partition point according to the given predicate (the index of the first element of the second partition).
    `void` | `putAt(IntRange range, float[] source)` A helper method to allow arrays to be set with subscript operators.
    `void` | `putAt(IntRange range, Iterable source)` A helper method to allow arrays to be set with subscript operators.
    `float[]` | `reverse()` Creates a new float array containing items which are the same as this array but in reverse order.
    `float[]` | `reverse(boolean mutate)` Reverses the items in an array.
    `float[]` | `reverseEach(Closure closure)` Iterates through a float[] in reverse order passing each float to the given closure.
    `int` | `size()` Provides arrays with a `size` method similar to collections.
    `Stream` | `stream()` Returns a sequential Stream with the specified array as its source.
    `float` | `sum()` Sums the items in an array.
    `float` | `sum(float initialValue)` Sums the items in an array, adding the result to some initial value.
    `float` | `sum(FloatUnaryOperator operator)` Calculates the sum of values found from applying the operator to members of the float array.
    `float[]` | `swap(int i, int j)` Swaps two elements at the specified positions.
    `float[]` | `tail()` Returns the items from the float array excluding the first item.
    `List` | `toList()` Converts this array to a List of the same size, with each element added to the list.
    `Set` | `toSet()` Converts this array to a Set, with each unique element added to the set.
    `String` | `toString()` Returns the string representation of the given array.
    `List` | `withIndex()` Zips a float array with indices in (value, index) order.
    `List` | `withIndex(int offset)` Zips a float array with indices in (value, index) order starting from a given index.
    `List` | `zip(float[] other)` A list of all the pairs from two arrays.
    `Iterator` | `zipping(float[] other)` An iterator of all the pairs from two arrays.

- - ### Methods Detail

    - #### public boolean any(Closure predicate)

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

          float[] array = [0.0f, 1.0f, 2.0f]
          assert array.any{ it > 1.5f }
          assert !array.any{ it > 2.5f }

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

    - #### public boolean asBoolean()

      Coerces a float array to a boolean value. A float array is false if the array is of length 0, and true otherwise.

      Returns:
        the array's boolean value
      Since:
        1.7.4

    - #### public double average()

      Calculates the average of the floats in the array.

          assert 5.0d == ([2,4,6,8] as float[]).average()

      Returns:
        The average of the items
      Since:
        3.0.0

    - #### public List chop(int chopSizes)

      Chops the float 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.

          float[] array = [0, 1, 2]
          assert array.chop(1, 2) == [[0], [1, 2]]

      Parameters:
        `chopSizes` - the sizes for the returned pieces
      Returns:
        a list of lists chopping the original array elements into pieces determined by chopSizes
      Since:
        5.0.0
      See Also:
        ArrayGroovyMethods#collate(Object[], int) to chop a list into pieces of a fixed size

    - #### 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`).

          float[] array = [10.0f, 20.0f, 20.0f, 30.0f]
          assert array.count(20.0f) == 2

      Parameters:
        `value` - the value being searched for
      Returns:
        the number of occurrences
      Since:
        1.6.4
      See Also:
        DefaultGroovyMethods#count(Iterator, Object)

    - #### public float[] each(Consumer consumer)

      Iterates through a float[] passing each float to the given consumer.

          float[] array = [0f, 1f, 2f]
          String result = ''
          array.each{ result += it }
          assert result == '0.01.02.0'

      Parameters:
        `consumer` - the consumer for each float
      Returns:
        the self array
      Since:
        5.0.0

    - #### public float[] eachWithIndex(Closure closure)

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

          float[] array = [10f, 20f, 30f]
          String result = ''
          array.eachWithIndex{ item, index -> result += "$index($item)" }
          assert result == '0(10.0)1(20.0)2(30.0)'

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

    - #### public boolean equals(float[] right)

      Compares the contents of this array to the contents of the given array.

      Example usage:

          float[] array1 = [4.0f, 8.0f]
          float[] array2 = [4.0f, 8.0f]
          assert array1 !== array2
          assert array1.equals(array2)

      Parameters:
        `right` - the array being compared
      Returns:
        true if the contents of both arrays are equal.
      Since:
        5.0.0

    - #### public boolean every(Closure predicate)

      Iterates over the contents of a float Array, and checks whether a predicate is valid for all elements.

          float[] array = [0.0f, 1.0f, 2.0f]
          assert array.every{ it < 2.5f }
          assert !array.every{ it > 1.5f }

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

    - #### public float first()

      Returns the first item from the float array.

          float[] floats = [2.0f, 4.0f, 6.0f]
          assert floats.first() == 2.0f

      An alias for `head()`.
      Returns:
        the first element
      Since:
        5.0.0

    - #### public List flatten()

      Flattens an array. This array is added to a new collection. It is an alias for `toList()` but allows algorithms to be written which also work on multidimensional arrays or non-arrays where flattening would be applicable.

          float[] array = [0.0f, 1.0f]
          assert array.flatten() == [0.0f, 1.0f]

      Returns:
        a Collection of the array elements
      Since:
        1.6.0

    - #### public List getAt(IntRange range)

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

          float[] array = [0.0f, 10.0f, 20.0f, 30.0f, 40.0f]
          assert array[2..3] == [20.0f, 30.0f]
          assert array[-2..-1] == [30.0f, 40.0f]
          assert array[-1..-2] == [40.0f, 30.0f]

      Parameters:
        `range` - an IntRange indicating the indices for the items to retrieve
      Returns:
        list of the retrieved floats
      Since:
        1.0

    - #### public List getAt(ObjectRange range)

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

          float[] array = [0.0f, 10.0f, 20.0f, 30.0f, 40.0f]
          def range = new ObjectRange(2, 3)
          assert array[range] == [20.0f, 30.0f]

      Parameters:
        `range` - an ObjectRange indicating the indices for the items to retrieve
      Returns:
        list of the retrieved floats
      Since:
        1.0

    - #### public List getAt(Range range)

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

          float[] array = [1.0f, 3.0f, 5.0f, 7.0f, 9.0f, 11.0f]
          assert array[2..<2] == [] // EmptyRange
          assert array[(0..5.5).step(2)] == [1.0f, 5.0f, 9.0f]   // NumberRange
          assert array[(1..5.5).step(2)] == [3.0f, 7.0f, 11.0f]  // NumberRange

      Parameters:
        `range` - a range indicating the indices for the items to retrieve
      Returns:
        list of the retrieved floats
      Since:
        1.0

    - #### public List getAt(Collection indices)

      Supports the subscript operator for a float array with a (potentially nested) collection giving the desired indices.

          float[] array = [0.0f, 2.0f, 4.0f, 6.0f, 8.0f]
          assert array[2, 3] == [4.0f, 6.0f]
          assert array[1, 0..1, [0, [-1]]] == [2.0f, 0.0f, 2.0f, 0.0f, 8.0f]

      Parameters:
        `indices` - a collection of indices for the items to retrieve
      Returns:
        list of the floats at the given indices
      Since:
        1.0

    - #### public IntRange getIndices()

      Returns indices of the float array.

          float[] array = [0.0f, 1.0f]
          assert array.indices == 0..1

      Since:
        3.0.8
      See Also:
        ArrayGroovyMethods#getIndices(Object[])

    - #### public float head()

      Returns the first item from the float array.

          float[] floats = [2.0f, 4.0f, 6.0f]
          assert floats.head() == 2.0f

      An alias for `first()`.
      Returns:
        the first element
      Since:
        5.0.0

    - #### public Map indexed()

      Zips a float[] with indices in (index, value) order starting from index 0.

      Example usage:

          float[] nums = [10.0f, 20.0f, 30.0f]
          assert [0: 10.0f, 1: 20.0f, 2: 30.0f] == nums.indexed()

      Since:
        5.0.0
      See Also:
        float[]#indexed(int)

    - #### public Map indexed(int offset)

      Zips a float[] with indices in (index, value) order starting from a given index.

      Example usage:

          float[] nums = [10.0f, 20.0f, 30.0f]
          assert [5: 10.0f, 6: 20.0f, 7: 30.0f] == nums.indexed(5)

      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
      Since:
        5.0.0
      See Also:
        DefaultGroovyMethods#indexed(Iterable, int)

    - #### public float[] init()

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

          float[] floats = [2.0f, 4.0f, 6.0f]
          def result = floats.init()
          assert result == [2.0f, 4.0f]
          assert floats.class.componentType == result.class.componentType

      Returns:
        an array without its last element
      Since:
        5.0.0

    - #### public String join()

      Concatenates the string representation of each item in this array.

      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.

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

    - #### public float last()

      Returns the last item from the float array.

          float[] floats = [2.0f, 4.0f, 6.0f]
          assert floats.last() == 6.0f

      Returns:
        the last element
      Since:
        5.0.0

    - #### public float max()

      Adds max() method to float arrays.

      Example usage:

          float[] nums = [1.1f, 3.3f, 2.2f]
          assert 3.3f == nums.max()

      Returns:
        the maximum value
      Since:
        5.0.0

    - #### public float max(FloatComparator comparator)

      Selects the maximum value found from the float array using the supplied FloatComparator to determine the maximum of any two values.

          double[] nums = [10f, 20f, -30f]
          assert 20f == nums.max{ n, m -> n <=> m }
          assert -30f == nums.max{ n, m -> n.abs() <=> m.abs() }

      Parameters:
        `comparator` - a comparator, i.e. returns a negative value if the first parameter is less than the second
      Returns:
        the maximum value
      Since:
        5.0.0

    - #### public float max(FloatUnaryOperator operator)

      Selects the maximum value found from the float array using the supplied FloatUnaryOperator to determine the maximum of any two values. The operator is applied to each array element and the results are compared.

          float[] nums = [10f, 20f, -30f]
          assert -30f == nums.max{ it.abs() }
          assert 20f == nums.max{ it }

      Parameters:
        `operator` - an operator that returns a float used for comparing values
      Returns:
        the maximum value
      Since:
        5.0.0

    - #### public float maxComparing(Comparator comparator)

      Selects the maximum value found from the float array using the comparator to determine the maximum of any two values.

          double[] nums = [10.0f, 20.0f, 30.0f]
          assert 30f == nums.maxComparing(Comparator.naturalOrder())
          assert 10f == nums.maxComparing(Comparator.reverseOrder())

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

    - #### public float min()

      Adds min() method to float arrays.

      Example usage:

          float[] nums = [1.1f, 3.3f, 2.2f]
          assert 1.1f == nums.min()

      Returns:
        the minimum value
      Since:
        5.0.0

    - #### public float min(FloatComparator comparator)

      Selects the minimum value found from the float array using the supplied FloatComparator to determine the minimum of any two values.

          double[] nums = [10f, -20f, 30f]
          assert -20f == nums.min{ n, m -> n <=> m }
          assert 10f == nums.min{ n, m -> n.abs() <=> m.abs() }

      Parameters:
        `comparator` - a comparator, i.e. returns a negative value if the first parameter is less than the second
      Returns:
        the minimum value
      Since:
        5.0.0

    - #### public float min(FloatUnaryOperator operator)

      Selects the minimum value found from the float array using the supplied FloatUnaryOperator to determine the minimum of any two values. The operator is applied to each array element and the results are compared.

          double[] nums = [10f, -20f, 30f]
          assert -20f == nums.min{ it }
          assert 10f == nums.min{ it.abs() }

      Parameters:
        `operator` - an operator that returns a double used for comparing values
      Returns:
        the minimum value
      Since:
        5.0.0

    - #### public float minComparing(Comparator comparator)

      Selects the minimum value found from the float array using the comparator to determine the minimum of any two values.

          double[] nums = [10.0f, 20.0f, 30.0f]
          assert 10f == nums.minComparing(Comparator.naturalOrder())
          assert 30f == nums.minComparing(Comparator.reverseOrder())

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

    - #### public int partitionPoint(IntRange range, DoublePredicate 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 float[]
          assert arr.partitionPoint(0..<arr.size()) { it%2 != 0 } == 4

          def arr = [1, 2, 3, 3, 4, 4, 5, 6, 7] as float[]
          // 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

    - #### public int partitionPoint(DoublePredicate 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 float[]
          assert arr.partitionPoint{ it%2 != 0 } == 4

          def arr = [1, 2, 3, 3, 4, 4, 5, 6, 7] as float[]
          // 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

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

    - #### public void putAt(IntRange range, float[] source)

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

          float[] from = [1f, 1f, 1f]
          float[] to = [0f, 0f, 0f, 0f, 0f]
          to[1..3] = from
          assert to == [0f, 1f, 1f, 1f, 0f]

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

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

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

          def from = [1f, 1f, 1f]
          float[] to = [0f, 0f, 0f, 0f, 0f]
          to[1..3] = from
          assert to == [0f, 1f, 1f, 1f, 0f]

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

    - #### public float[] reverse()

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

          float[] array = [1f, 2f]
          assert array.reverse() == [2f, 1f]

      Returns:
        an array containing the reversed items
      Since:
        5.0.0
      See Also:
        float[]#reverse(boolean)

    - #### public float[] 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.

          float[] array = 1f..3f
          def yarra = array.reverse(true)
          assert array == 3f..1f
          assert yarra == 3f..1f
          assert array === yarra
          yarra = array.reverse(false)
          assert array !== yarra
          assert array == 3f..1f
          assert yarra == 1f..3f

      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:
        5.0.0

    - #### public float[] reverseEach(Closure closure)

      Iterates through a float[] in reverse order passing each float to the given closure.

          float[] array = [0, 1, 2]
          String result = ''
          array.reverseEach{ result += it }
          assert result == '2.01.00.0'

      Parameters:
        `closure` - the closure applied on each float
      Returns:
        the self array
      Since:
        5.0.0

    - #### public int size()

      Provides arrays with a `size` method similar to collections.

      Returns:
        the length of the array
      Since:
        1.0

    - #### public Stream stream()

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

      Returns:
        a `Stream` for the array
      Since:
        2.5.0

    - #### public float sum()

      Sums the items in an array.

          assert (1+2+3+4 as float) == ([1,2,3,4] as float[]).sum()

      Returns:
        The sum of all the items
      Since:
        2.4.2

    - #### public float sum(float initialValue)

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

          assert (5+1+2+3+4 as float) == ([1,2,3,4] as float[]).sum(5)

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

    - #### public float sum(FloatUnaryOperator operator)

      Calculates the sum of values found from applying the operator to members of the float array.

          float[] nums = [10f, -20f, 30f]
          assert 20f == nums.sum{ n -> n }
          assert 60f == nums.sum{ n -> n.abs() }

      Parameters:
        `operator` - an operator that returns a float used for summing values
      Returns:
        the sum value of all values after applying the operator
      Since:
        5.0.0

    - #### public float[] swap(int i, int j)

      Swaps two elements at the specified positions.

      Example:

          assert ([1, 3, 2, 4] as float[]) == ([1, 2, 3, 4] as float[]).swap(1, 2)

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

    - #### public float[] tail()

      Returns the items from the float array excluding the first item.

          float[] floats = [2.0f, 4.0f, 6.0f]
          def result = floats.tail()
          assert result == [4.0f, 6.0f]
          assert floats.class.componentType == result.class.componentType

      Returns:
        an array without its first element
      Since:
        5.0.0

    - #### public List toList()

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

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

    - #### public Set toSet()

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

          float[] array = [1.0f, 2.0f, 3.0f, 2.0f, 1.0f]
          Set expected = [1.0f, 2.0f, 3.0f]
          assert array.toSet() == expected

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

    - #### public String toString()

      Returns the string representation of the given array.

          float[] array = [1, 2, 3, 2, 1]
          assert array.toString() == '[1.0, 2.0, 3.0, 2.0, 1.0]'

      Returns:
        the string representation
      Since:
        1.6.0

    - #### public List withIndex()

      Zips a float array with indices in (value, index) order.

      Example usage:

          float[] nums = [42.0f, -1.0f]
          assert [[42.0f, 0], [-1.0f, 1]] == nums.withIndex()
          assert ["0: 42.0", "1: -1.0"] == nums.withIndex().collect { n, idx -> "$idx: $n" }

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

    - #### public List withIndex(int offset)

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

      Example usage:

          float[] nums = [42.0f, -1.0f]
          assert [[42.0f, 5], [-1.0f, 6]] == nums.withIndex(5)
          assert ["5: 42.0", "6: -1.0"] == nums.withIndex(5).collect { n, idx -> "$idx: $n" }

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

    - #### public List zip(float[] other)

      A list of all the pairs from two arrays.

          float[] small = [1.0f, 2.0f, 3.0f]
          float[] large = [100f, 200f, 300f]
          assert [small, large].transpose() == small.zip(large)

      Parameters:
        `other` - another float[]
      Returns:
        a list of all the pairs from self and other
      Since:
        5.0.0

    - #### public Iterator zipping(float[] other)

      An iterator of all the pairs from two arrays.

          float[] small = [1.0f, 2.0f, 3.0f]
          float[] large = [100f, 200f, 300f]
          assert [small, large].transpose() == small.zipping(large).toList()

      Parameters:
        `other` - another float[]
      Returns:
        an iterator of all the pairs from self and other
      Since:
        5.0.0