GroovyCollections (groovy 2.4.9 API)
Date: 2017-02-24

Package: groovy.util

## [Java] Class GroovyCollections

- groovy.util.GroovyCollections

- A Collections utility class

  Authors:
    Paul King
    Jim White

- - ### Methods Summary

    Methods
    Type Params | Return Type | Name and description
    --- | --- | ---
    `` | `static List` | `combinations(Object[] collections)` Finds all combinations of items from the given collections.
    `` | `static List` | `combinations(Collection collections)` @param collections the given collections
    `` | `static List` | `combinations(Iterable collections)` Finds all combinations of items from the given Iterable aggregate of collections.
    `<T>` | `static T` | `max(T[] items)` Selects the maximum value found in an array of items, so min([2, 4, 6] as Object[]) == 6.
    `<T>` | `static T` | `max(Collection<T> items)` @deprecated use max(Iterable)
    `<T>` | `static T` | `max(Iterable<T> items)` Selects the maximum value found in an Iterable.
    `<T>` | `static T` | `min(T[] items)` Selects the minimum value found in an array of items, so min([2, 4, 6] as Object[]) == 2.
    `<T>` | `static T` | `min(Collection<T> items)` @deprecated use min(Iterable)
    `<T>` | `static T` | `min(Iterable<T> items)` Selects the minimum value found in an Iterable of items.
    `<T>` | `static Set<List<T>>` | `subsequences(List<T> items)` Finds all non-null subsequences of a list.
    `` | `static Object` | `sum(Object[] items)` Sums all the items from an array of items.
    `` | `static Object` | `sum(Collection items)` @deprecated use sum(Iterable)
    `` | `static Object` | `sum(Iterable items)` Sums all the given items.
    `` | `static List` | `transpose(Object[] lists)` Transposes an array of lists.
    `` | `static List` | `transpose(List lists)` Transposes the given lists.

  - ### Inherited Methods Summary

    Inherited Methods
    Methods inherited from class | Name
    --- | ---
    `class Object` | `wait, wait, wait, equals, toString, hashCode, getClass, notify, notifyAll`

- - ### Method Detail

    - #### public static List combinations(Object[] collections)

      Finds all combinations of items from the given collections.

      Returns:
        a List of the combinations found
      Parameters:
        `collections` - the given collections
      See Also:
        combinations(Collection)

    - #### @Deprecated public static List combinations(Collection collections)

      deprecated:
        use combinations(Iterable)
      Parameters:
        `collections` - the given collections

    - #### public static List combinations(Iterable collections)

      Finds all combinations of items from the given Iterable aggregate of collections. 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]]`. If a non-collection item is given, it is treated as a singleton collection, i.e. `combinations([[1, 2], 'x'])` is `[[1, 'x'], [2, 'x']]`.

      Returns:
        a List of the combinations found
      Parameters:
        `collections` - the Iterable of given collections
      Since:
        2.2.0

    - #### <T> public static T max(T[] items)

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

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

    - #### <T> @Deprecated public static T max(Collection<T> items)

      deprecated:
        use max(Iterable)

    - #### <T> public static T max(Iterable<T> items)

      Selects the maximum value found in an Iterable.

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

    - #### <T> public static T min(T[] items)

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

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

    - #### <T> @Deprecated public static T min(Collection<T> items)

      deprecated:
        use min(Iterable)

    - #### <T> public static T min(Iterable<T> items)

      Selects the minimum value found in an Iterable of items.

      Returns:
        the minimum value
      Parameters:
        `items` - an Iterable
      Since:
        2.2.0

    - #### <T> public static Set<List<T>> subsequences(List<T> items)

      Finds all non-null subsequences of a list. E.g. `subsequences([1, 2, 3])` would be: [[1, 2, 3], [1, 3], [2, 3], [1, 2], [1], [2], [3]]

      Returns:
        the subsequences from items
      Parameters:
        `items` - the List of items

    - #### public static Object sum(Object[] items)

      Sums all the items from an array of items.

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

    - #### @Deprecated public static Object sum(Collection items)

      deprecated:
        use sum(Iterable)

    - #### public static Object sum(Iterable items)

      Sums all the given items.

      Returns:
        the sum of the item
      Parameters:
        `items` - an Iterable of items
      Since:
        2.2.0

    - #### public static List transpose(Object[] lists)

      Transposes an array of lists.

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

    - #### public static List transpose(List lists)

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

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