JavaScript is disabled on your browser.
  • Summary:
  • Nested Field Constructor
  • Method
  • | Detail:
  • Field Constructor
  • Method
Package: groovy.util

[Java] Class GroovyCollections

  • A Collections utility class

    Authors:
    Paul King
    Jim White

    • Method Detail

      • public static List combinations(Object[] collections)

        Finds all combinations of items from the given collections.

        Parameters:
        collections - the given collections
        Returns:
        a List of the combinations found
        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']].

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

      • public static T max(T[] 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

      • public static T max(Iterable<T> items)

        Selects the maximum value found in an Iterable.

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

      • public static T min(T[] 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

      • public static T min(Iterable<T> items)

        Selects the minimum value found in an Iterable of items.

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

      • 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]]

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

      • 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

      • public static Object sum(Iterable items)

        Sums all the given items.

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

      • public static List transpose(Object[] lists)

        Transposes an array of lists.

        Parameters:
        lists - the given lists
        Returns:
        a List of the transposed 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']].

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

  • Summary:
  • Nested Field Constructor
  • Method
  • | Detail:
  • Field Constructor
  • Method

Copyright © 2003-2016 The Apache Software Foundation. All rights reserved.

AltStyle によって変換されたページ (->オリジナル) /