|
Groovy 2.2.0 | |||||||
FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object groovy.util.GroovyCollections
public class GroovyCollections extends Object
A Collections utility class
Method Summary | |
---|---|
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. |
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
|
max(Collection items)
@deprecated use max(Iterable) |
static Object
|
max(Iterable items)
Selects the maximum value found in an Iterable. |
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
|
min(Collection items)
@deprecated use min(Iterable) |
static Object
|
min(Iterable items)
Selects the minimum value found in an Iterable of items. |
static Set
|
subsequences(List 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. |
Methods inherited from class Object | |
---|---|
wait, wait, wait, equals, toString, hashCode, getClass, notify, notifyAll |
Method Detail |
---|
public static List combinations(Object[] collections)
collections
- the given collections
@Deprecatedpublic static List combinations(Collection collections) { public static List combinations(Collection collections)
collections
- the given collections
public static List combinations(Iterable collections)
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']]
.
collections
- the Iterable of given collections
public static Object max(Object[] items)
items
- an array of items
@Deprecatedpublic staticT max(Collection items) { public static Object max(Collection items)
public static Object max(Iterable items)
items
- a Collection
public static Object min(Object[] items)
items
- an array of items
@Deprecatedpublic staticT min(Collection items) { public static Object min(Collection items)
public static Object min(Iterable items)
items
- an Iterable
public static Set subsequences(List items)
subsequences([1, 2, 3])
would be:
[[1, 2, 3], [1, 3], [2, 3], [1, 2], [1], [2], [3]]
items
- the List of items
public static Object sum(Object[] items)
items
- an array of items
@Deprecatedpublic static Object sum(Collection items) { public static Object sum(Collection items)
public static Object sum(Iterable items)
items
- an Iterable of items
public static List transpose(Object[] lists)
lists
- the given lists
public static List transpose(List lists)
transpose([['a', 'b'], [1, 2]])
is [['a', 1], ['b', 2]]
and
transpose([['a', 'b', 'c']])
is [['a'], ['b'], ['c']]
.
lists
- the given lists
Copyright © 2003-2013 The Codehaus. All rights reserved.