## groovy.util
Class GroovyCollections

    java.lang.Object
      groovy.util.GroovyCollections

    public class GroovyCollections

extends Object

A Collections utility class

Author:
  Paul King

Constructor Summary
`GroovyCollections()`

Method Summary
`static List` `combinations(Collection lists)` Finds all combinations of items from a collection of lists.
`static List` `combinations(Object[] lists)` Finds all combinations of items from an array of lists.
`static Object` `max(Collection items)` Selects the maximum value found in a collection
`static Object` `max(Object[] items)` Selects the maximum value found in an array of items, so min([2, 4, 6] as Object[]) == 6.
`static Object` `min(Collection items)` Selects the minimum value found in a collection of items.
`static Object` `min(Object[] items)` Selects the minimum value found in an array of items, so min([2, 4, 6] as Object[]) == 2.
`static Object` `sum(Collection items)` Sums all the items from a collection of items.
`static Object` `sum(Object[] items)` Sums all the items from an array of items.
`static List` `transpose(Collection lists)` Transposes a collection of lists.
`static List` `transpose(Object[] lists)` Transposes an array of lists.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### GroovyCollections

    public GroovyCollections()

Method Detail

### combinations

    public static List combinations(Object[] lists)

  Finds all combinations of items from an array of lists.

  Parameters:
    `lists` - an array of lists
  Returns:
    a List of the combinations found
  See Also:
    `combinations(Collection)`

### combinations

    public static List combinations(Collection lists)

  Finds all combinations of items from a collection of lists. So, `combinations([[true, false], [true, false]])` is `[[true, true], [false, true], [true, false], [false, false]]` and `combinations([['a', 'b'],[1, 2, 3]])` is `[['a', 1], ['b', 1], ['a', 2], ['b', 2], ['a', 3], ['b', 3]]`.

  Parameters:
    `lists` - a Collection of lists
  Returns:
    a List of the combinations found

### transpose

    public static List transpose(Object[] lists)

  Transposes an array of lists.

  Parameters:
    `lists` - an array of lists
  Returns:
    a List of the transposed lists
  See Also:
    `transpose(Collection)`

### transpose

    public static List transpose(Collection lists)

  Transposes a collection of lists. So, `transpose([['a', 'b'], [1, 2]])` is `[['a', 1], ['b', 2]]` and. `transpose([['a', 'b', 'c']])` is `[['a'], ['b'], ['c']]` and.

  Parameters:
    `lists` - a Collection of lists
  Returns:
    a List of the transposed lists

### min

    public static Object min(Object[] items)

  Selects the minimum value found in an array of items, so min([2, 4, 6] as Object[]) == 2.

  Parameters:
    `items` - an array of items
  Returns:
    the minimum value

### min

    public static Object min(Collection items)

  Selects the minimum value found in a collection of items.

  Parameters:
    `items` - a Collection
  Returns:
    the minimum value

### max

    public static Object max(Object[] items)

  Selects the maximum value found in an array of items, so min([2, 4, 6] as Object[]) == 6.

  Parameters:
    `items` - an array of items
  Returns:
    the maximum value

### max

    public static Object max(Collection items)

  Selects the maximum value found in a collection

  Parameters:
    `items` - a Collection
  Returns:
    the maximum value

### sum

    public static Object sum(Object[] items)

  Sums all the items from an array of items.

  Parameters:
    `items` - an array of items
  Returns:
    the sum of the items

### sum

    public static Object sum(Collection items)

  Sums all the items from a collection of items.

  Parameters:
    `items` - a collection of items
  Returns:
    the sum of the items

Copyright © 2003-2008 The Codehaus. All rights reserved.