|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectgroovy.util.GroovyCollections
public class GroovyCollections
A Collections utility class
Constructor Summary | |
---|---|
GroovyCollections()
|
Method Summary | |
---|---|
static java.util.List |
combinations(java.util.Collection lists)
Finds all combinations of items from a collection of lists. |
static java.util.List |
combinations(java.lang.Object[] lists)
Finds all combinations of items from an array of lists. |
static java.lang.Object |
max(java.util.Collection items)
Selects the maximum value found in a collection |
static java.lang.Object |
max(java.lang.Object[] items)
Selects the maximum value found in an array of items, so min([2, 4, 6] as Object[]) == 6. |
static java.lang.Object |
min(java.util.Collection items)
Selects the minimum value found in a collection of items. |
static java.lang.Object |
min(java.lang.Object[] items)
Selects the minimum value found in an array of items, so min([2, 4, 6] as Object[]) == 2. |
static java.lang.Object |
sum(java.util.Collection items)
Sums all the items from a collection of items. |
static java.lang.Object |
sum(java.lang.Object[] items)
Sums all the items from an array of items. |
static java.util.List |
transpose(java.util.Collection lists)
Transposes a collection of lists. |
static java.util.List |
transpose(java.lang.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 |
---|
public GroovyCollections()
Method Detail |
---|
public static java.util.List combinations(java.lang.Object[] lists)
lists
- an array of lists
combinations(Collection)
public static java.util.List combinations(java.util.Collection lists)
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]]
.
lists
- a Collection of lists
public static java.util.List transpose(java.lang.Object[] lists)
lists
- an array of lists
transpose(Collection)
public static java.util.List transpose(java.util.Collection lists)
transpose([['a', 'b'], [1, 2]])
is [['a', 1], ['b', 2]]
and.
transpose([['a', 'b', 'c']])
is [['a'], ['b'], ['c']]
and.
lists
- a Collection of lists
public static java.lang.Object min(java.lang.Object[] items)
items
- an array of items
public static java.lang.Object min(java.util.Collection items)
items
- a Collection
public static java.lang.Object max(java.lang.Object[] items)
items
- an array of items
public static java.lang.Object max(java.util.Collection items)
items
- a Collection
public static java.lang.Object sum(java.lang.Object[] items)
items
- an array of items
public static java.lang.Object sum(java.util.Collection items)
items
- a collection of items
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |