Top Description Inners Fields Constructors Methods
org.codehaus.groovy.runtime

public Class DefaultGroovyMethods

extends DefaultGroovyMethodsSupport
Class Inheritance
Imports
groovy.io.GroovyPrintWriter, groovy.lang.Closure, .DelegatesTo, .DelegatingMetaClass, .EmptyRange, .ExpandoMetaClass, .GroovyObject, .GroovyRuntimeException, .GroovySystem, .Groovydoc, .IntRange, .ListWithDefault, .MapWithDefault, .MetaClass, .MetaClassImpl, .MetaClassRegistry, .MetaMethod, .MetaProperty, .MissingPropertyException, .ObjectRange, .PropertyValue, .Range, .SpreadMap, .Tuple2, groovy.transform.stc.ClosureParams, .FirstParam, .FromString, .MapEntryOrKeyValue, .SimpleType, groovy.util.BufferedIterator, .ClosureComparator, .GroovyCollections, .MapEntry, .OrderBy, .PermutationGenerator, .ProxyGenerator, org.apache.groovy.io.StringBuilderWriter, org.codehaus.groovy.classgen.Verifier, org.codehaus.groovy.reflection.ClassInfo, .MixinInMetaClass, .ReflectionCache, .ReflectionUtils, org.codehaus.groovy.reflection.stdclasses.CachedSAMClass, org.codehaus.groovy.runtime.callsite.BooleanClosureWrapper, .BooleanReturningMethodInvoker, org.codehaus.groovy.runtime.dgmimpl.NumberNumberDiv, .NumberNumberMinus, .NumberNumberMultiply, .NumberNumberPlus, org.codehaus.groovy.runtime.dgmimpl.arrays.BooleanArrayGetAtMetaMethod, .BooleanArrayPutAtMetaMethod, .ByteArrayGetAtMetaMethod, .ByteArrayPutAtMetaMethod, .CharacterArrayGetAtMetaMethod, .CharacterArrayPutAtMetaMethod, .DoubleArrayGetAtMetaMethod, .DoubleArrayPutAtMetaMethod, .FloatArrayGetAtMetaMethod, .FloatArrayPutAtMetaMethod, .IntegerArrayGetAtMetaMethod, .IntegerArrayPutAtMetaMethod, .LongArrayGetAtMetaMethod, .LongArrayPutAtMetaMethod, .ObjectArrayGetAtMetaMethod, .ObjectArrayPutAtMetaMethod, .ShortArrayGetAtMetaMethod, .ShortArrayPutAtMetaMethod, org.codehaus.groovy.runtime.metaclass.MetaClassRegistryImpl, .MissingPropertyExceptionNoStack, org.codehaus.groovy.runtime.typehandling.DefaultTypeTransformation, .GroovyCastException, .NumberMath, org.codehaus.groovy.tools.RootLoader, org.codehaus.groovy.transform.trait.Traits, org.codehaus.groovy.util.ArrayIterable, .ArrayIterator, .BooleanArrayIterator, .ByteArrayIterator, .CharArrayIterator, .DoubleArrayIterable, .DoubleArrayIterator, .FloatArrayIterator, .IntArrayIterable, .IntArrayIterator, .IteratorBufferedIterator, .ListBufferedIterator, .LongArrayIterable, .LongArrayIterator, .ShortArrayIterator, java.io.ByteArrayOutputStream, .IOException, .PrintStream, .PrintWriter, .Writer, java.lang.reflect.AnnotatedElement, .Array, .Field, .Modifier, .Proxy, java.math.BigDecimal, .BigInteger, .RoundingMode, java.net.URL, java.security.AccessController, .CodeSource, .PrivilegedAction, java.text.MessageFormat, java.util.AbstractCollection, .AbstractMap, .ArrayList, .Arrays, .BitSet, .Collection, .Collections, .Comparator, .Deque, .Enumeration, .HashSet, .Iterator, .LinkedHashMap, .LinkedHashSet, .LinkedList, .List, .ListIterator, .Map, .NoSuchElementException, .Objects, .Queue, .Random, .Set, .SortedMap, .SortedSet, .Stack, .Timer, .TimerTask, .TreeMap, .TreeSet, java.util.concurrent.BlockingQueue, java.util.logging.Logger

This class defines new groovy methods which appear on normal JDK classes inside the Groovy environment. Static methods are used with the first parameter being the destination class, i.e. public static String reverse(String self) provides a reverse() method for String.

Note

While this class contains many 'public' static methods, it is primarily regarded as an internal class (its internal package name suggests this also). We value backwards compatibility of these methods when used within Groovy but value less backwards compatibility at the Java method call level. I.e. future versions of Groovy may remove or move a method call in this file but would normally aim to keep the method available from within Groovy.

Nested and Inner Type Summary

Modifier and TypeClass and Description
private static class
private static class
private static class
private static class
private static class
private static class
private static class
private static class
private static class
private static class

Field Summary

Modifier and TypeField and Description
public static final Class<T>[]
private static final BigInteger
private static final BigInteger
private static final BigInteger
private static final BigInteger
private static final NumberAwareComparator<Comparable<T>>
public static final Class<T>[]
private static final Object[]
private static final Logger
private static final Integer
private static Random
r

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public static int

Returns:

the absolute value of that Number
abs
(Number
a Number
number
)

Get the absolute value

public static long

Returns:

the absolute value of that Long
abs
(Long
a Long
number
)

Get the absolute value

public static float

Returns:

the absolute value of that Float
abs
(Float
a Float
number
)

Get the absolute value

public static double

Returns:

the absolute value of that Double
abs
(Double
a Double
number
)

Get the absolute value

public static <T> boolean

Returns:

true if this collection changed as a result of the call
addAll
(Collection<T>
a Collection to be modified
self
,
T[]
array containing elements to be added to this collection
items
)

Modifies the collection by adding all of the elements in the specified array to the collection.

public static <T> boolean

Returns:

true if this collection changed as a result of the call
addAll
(List<T>
a list to be modified
self
,
int
index at which to insert the first element from the specified array
index
,
T[]
array containing elements to be added to this collection
items
)

Modifies this list by inserting all of the elements in the specified array into the list at the specified position.

public static <T> boolean

Returns:

true if the collection changed
addAll
(Collection<T>
the collection
self
,
Iterator<? extends T>
the items to add
items
)

Adds all items from the iterator to the Collection.

public static <T> boolean

Returns:

true if the collection changed
addAll
(Collection<T>
the collection
self
,
Iterable<? extends T>
the items to add
items
)

Adds all items from the iterable to the Collection.

private static <K, V> void
addEntry(Map<K, V> result, Object newEntry)

public static void
addShutdownHook(Object
the object the method is called on (ignored)
self
,
Closure<V>
the shutdown hook action
closure
)

Allows the usage of addShutdownHook without getting the runtime first.

public static Number

Returns:

the bitwise AND of both Numbers
and
(Number
a Number
left
,
Number
another Number to bitwise AND
right
)

Bitwise AND together two Numbers.

public static BitSet

Returns:

the bitwise AND of both BitSets
and
(BitSet
a BitSet
left
,
BitSet
another BitSet to bitwise AND
right
)

Bitwise AND together two BitSets.

public static Boolean

Returns:

result of logical conjunction
and
(Boolean
left operator
left
,
Boolean
right operator
right
)

Logical conjunction of two boolean operators.

public static boolean

Returns:

true if any iteration for the object matches the closure predicate
any
(Object
the object over which we iterate
self
,
Closure<V>
the closure predicate used for matching
predicate
)

Iterates over the contents of an object or collection, and checks whether a predicate is valid for at least one element.

public static <T> boolean

Returns:

true if any iteration for the object matches the closure predicate
any
(Iterator<T>
the iterator over which we iterate
self
,
Closure<V>
the closure predicate used for matching
predicate
)

Iterates over the contents of an iterator, and checks whether a predicate is valid for at least one element.

public static <T> boolean

Returns:

true if any iteration for the object matches the closure predicate
any
(Iterable<T>
the iterable over which we iterate
self
,
Closure<V>
the closure predicate used for matching
predicate
)

Iterates over the contents of an iterable, and checks whether a predicate is valid for at least one element.

public static <T> boolean

Returns:

true if any iteration for the object matches the closure predicate
any
(T[]
the array over which we iterate
self
,
Closure<V>
the closure predicate used for matching
predicate
)

Iterates over the contents of an Array, and checks whether a predicate is valid for at least one element.

public static <K, V> boolean

Returns:

true if any entry in the map matches the closure predicate
any
(Map<K, V>
the map over which we iterate
self
,
Closure<?>
the 1 or 2 arg closure predicate used for matching
predicate
)

Iterates over the entries of a map, and checks whether a predicate is valid for at least one entry.

public static boolean

Returns:

true if any item in the collection matches the closure predicate
any
(Object
the object over which we iterate
self
)

Iterates over the elements of a collection, and checks whether at least one element is true according to the Groovy Truth.

private static Object
asArrayType(Object object, Class<T> type)

public static boolean

Returns:

the boolean value
asBoolean
(Object
the object to coerce
object
)

Coerce an object instance to a boolean value.

public static boolean

Returns:

the boolean value
asBoolean
(Boolean
the Boolean
bool
)

Coerce a Boolean instance to a boolean value.

public static boolean

Returns:

the boolean value
asBoolean
(Collection<E>
the collection
collection
)

Coerce a collection instance to a boolean value.

public static boolean

Returns:

the boolean value
asBoolean
(Map<K, V>
the map
map
)

Coerce a map instance to a boolean value.

public static boolean

Returns:

the boolean value
asBoolean
(Iterator<E>
the iterator
iterator
)

Coerce an iterator instance to a boolean value.

public static boolean

Returns:

the boolean value
asBoolean
(Enumeration<E>
the enumeration
enumeration
)

Coerce an enumeration instance to a boolean value.

public static boolean

Returns:

the boolean value
asBoolean
(Object[]
the array
array
)

Coerce an Object array to a boolean value.

public static boolean

Returns:

the array's boolean value
asBoolean
(byte[]
an array
array
)

Coerces a byte array to a boolean value.

public static boolean

Returns:

the array's boolean value
asBoolean
(short[]
an array
array
)

Coerces a short array to a boolean value.

public static boolean

Returns:

the array's boolean value
asBoolean
(int[]
an array
array
)

Coerces an int array to a boolean value.

public static boolean

Returns:

the array's boolean value
asBoolean
(long[]
an array
array
)

Coerces a long array to a boolean value.

public static boolean

Returns:

the array's boolean value
asBoolean
(float[]
an array
array
)

Coerces a float array to a boolean value.

public static boolean

Returns:

the array's boolean value
asBoolean
(double[]
an array
array
)

Coerces a double array to a boolean value.

public static boolean

Returns:

the array's boolean value
asBoolean
(boolean[]
an array
array
)

Coerces a boolean array to a boolean value.

public static boolean

Returns:

the array's boolean value
asBoolean
(char[]
an array
array
)

Coerces a char array to a boolean value.

public static boolean

Returns:

the boolean value
asBoolean
(Character
the character
character
)

Coerce a character to a boolean value.

public static boolean

Returns:

true for non-zero and non-NaN values, else false
asBoolean
(Float
the Float
object
)

Coerce a Float instance to a boolean value.

public static boolean

Returns:

true for non-zero and non-NaN values, else false
asBoolean
(Double
the Double
object
)

Coerce a Double instance to a boolean value.

public static boolean

Returns:

the boolean value
asBoolean
(Number
the number
number
)

Coerce a number to a boolean value.

public static <T> Collection<T>

Returns:

a newly created List if this Iterable is not already a Collection
asCollection
(Iterable<T>
an Iterable to be converted into a Collection
self
)

Converts this Iterable to a Collection.

public static <K, V> Map<K, V>

Returns:

an unmodifiable view of a copy of the original, i.e. an effectively immutable copy
asImmutable
(Map<K, V>
a Map
self
)

A convenience method for creating an immutable Map.

public static <K, V> SortedMap<K, V>

Returns:

an unmodifiable view of a copy of the original, i.e. an effectively immutable copy
asImmutable
(SortedMap<K, V>
a SortedMap
self
)

A convenience method for creating an immutable SortedMap.

public static <T> List<T>

Returns:

an unmodifiable view of a copy of the original, i.e. an effectively immutable copy
asImmutable
(List<T>
a List
self
)

A convenience method for creating an immutable List.

public static <T> Set<T>

Returns:

an unmodifiable view of a copy of the original, i.e. an effectively immutable copy
asImmutable
(Set<T>
a Set
self
)

A convenience method for creating an immutable Set.

public static <T> SortedSet<T>

Returns:

an unmodifiable view of a copy of the original, i.e. an effectively immutable copy
asImmutable
(SortedSet<T>
a SortedSet
self
)

A convenience method for creating an immutable SortedSet.

public static <T> Collection<T>

Returns:

an unmodifiable view of a copy of the original, i.e. an effectively immutable copy
asImmutable
(Collection<T>
a Collection
self
)

A convenience method for creating an immutable Collection.

public static <T> List<T>
asList(Collection<T> self)

Deprecated Use the Iterable version of asList instead
public static <T> List<T>

Returns:

a newly created List if this Iterable is not already a List
asList
(Iterable<T>
an Iterable to be converted into a List
self
)

Converts this Iterable to a List.

public static String

Returns:

the detail information of stack trace
asString
(Throwable
a Throwable instance
self
)

Get the detail information of Throwable instance's stack trace

public static <K, V> Map<K, V>

Returns:

a synchronized Map
asSynchronized
(Map<K, V>
a Map
self
)

A convenience method for creating a synchronized Map.

public static <K, V> SortedMap<K, V>

Returns:

a synchronized SortedMap
asSynchronized
(SortedMap<K, V>
a SortedMap
self
)

A convenience method for creating a synchronized SortedMap.

public static <T> Collection<T>

Returns:

a synchronized Collection
asSynchronized
(Collection<T>
a Collection
self
)

A convenience method for creating a synchronized Collection.

public static <T> List<T>

Returns:

a synchronized List
asSynchronized
(List<T>
a List
self
)

A convenience method for creating a synchronized List.

public static <T> Set<T>

Returns:

a synchronized Set
asSynchronized
(Set<T>
a Set
self
)

A convenience method for creating a synchronized Set.

public static <T> SortedSet<T>

Returns:

a synchronized SortedSet
asSynchronized
(SortedSet<T>
a SortedSet
self
)

A convenience method for creating a synchronized SortedSet.

public static <T> T

Returns:

the object resulting from this type conversion
asType
(Iterable<T>
a Iterable
iterable
,
Class<T>
the desired class
clazz
)

Converts the given iterable to another type.

public static <T> T

Returns:

the object resulting from this type conversion
asType
(Collection<E>
a collection
col
,
Class<T>
the desired class
clazz
)

Converts the given collection to another type.

public static <T> T

Returns:

the object resulting from this type conversion
asType
(Object[]
an array
ary
,
Class<T>
the desired class
clazz
)

Converts the given array to either a List, Set, or SortedSet.

public static <T> T

Returns:

A proxy of the given type which wraps this closure.
asType
(final Closure<V>
the implementation of the single method
impl
,
final Class<T>
the target type
type
)

Coerces the closure to an implementation of the given class.

public static <T> T

Returns:

a Proxy of the given type, which defers calls to this map's elements.
asType
(Map<K, V>
this map
map
,
Class<T>
the target type
clazz
)

Coerces this map to the given type, using the map's keys as the public method names, and values as the implementation.

public static <T> T

Returns:

an instance of the given type
asType
(Number
this number
self
,
Class<T>
the desired type of the transformed result
c
)

Transform this number to a the given type, using the 'as' operator.

public static <T> T

Returns:

the resulting object
asType
(Object
the object to convert
obj
,
Class<T>
the goal type
type
)

Converts a given object to a type.

public static <K, V> Map<K, V>

Returns:

an unmodifiable view of the Map
asUnmodifiable
(Map<K, V>
a Map
self
)

Creates an unmodifiable view of a Map.

public static <K, V> SortedMap<K, V>

Returns:

an unmodifiable view of the SortedMap
asUnmodifiable
(SortedMap<K, V>
a SortedMap
self
)

Creates an unmodifiable view of a SortedMap.

public static <T> List<T>

Returns:

an unmodifiable view of the List
asUnmodifiable
(List<T>
a List
self
)

Creates an unmodifiable view of a List.

public static <T> Set<T>

Returns:

an unmodifiable view of the Set
asUnmodifiable
(Set<T>
a Set
self
)

Creates an unmodifiable view of a Set.

public static <T> SortedSet<T>

Returns:

an unmodifiable view of the SortedSet
asUnmodifiable
(SortedSet<T>
a SortedSet
self
)

Creates an unmodifiable view of a SortedSet.

public static <T> Collection<T>

Returns:

an unmodifiable view of the Collection
asUnmodifiable
(Collection<T>
a Collection
self
)

Creates an unmodifiable view of a Collection.

public static Object

Returns:

The average of all of the items
average
(Iterable<?>
Iterable of values to average
self
)

Averages the items in an Iterable.

public static Object

Returns:

The average of all of the items
average
(Object[]
The array of values to average
self
)

Averages the items in an array.

public static Object

Returns:

The average of all of the items
average
(Iterator<?>
an Iterator for the values to average
self
)

Averages the items from an Iterator.

public static BigDecimal

Returns:

The average of the items
average
(byte[]
The array of values to calculate the average of
self
)

Calculates the average of the bytes in the array.

public static BigDecimal

Returns:

The average of the items
average
(short[]
The array of values to calculate the average of
self
)

Calculates the average of the shorts in the array.

public static BigDecimal

Returns:

The average of the items
average
(int[]
The array of values to calculate the average of
self
)

Calculates the average of the ints in the array.

public static BigDecimal

Returns:

The average of the items
average
(long[]
The array of values to calculate the average of
self
)

Calculates the average of the longs in the array.

public static double

Returns:

The average of the items
average
(float[]
The array of values to calculate the average of
self
)

Calculates the average of the floats in the array.

public static double

Returns:

The average of the items
average
(double[]
The array of values to calculate the average of
self
)

Calculates the average of the doubles in the array.

public static <T> Object

Returns:

The average of the values returned by applying the closure to each item of the Iterable.
average
(Iterable<T>
an Iterable
self
,
Closure<V>
a single parameter closure that returns a (typically) numeric value.
closure
)

Averages the result of applying a closure to each item of an Iterable.

public static <T> Object

Returns:

The average of the values returned by applying the closure to each item of the array.
average
(T[]
An array
self
,
Closure<V>
a single parameter closure that returns a (typically) numeric value.
closure
)

Averages the result of applying a closure to each item of an array.

public static <T> Object

Returns:

The average of the values returned by applying the closure to each item from the Iterator.
average
(Iterator<T>
An Iterator
self
,
Closure<V>
a single parameter closure that returns a (typically) numeric value.
closure
)

Averages the result of applying a closure to each item returned from an iterator.

public static BitSet

Returns:

the bitwise NEGATE of the BitSet
bitwiseNegate
(BitSet
a BitSet
self
)

Bitwise NEGATE a BitSet.

public static Number

Returns:

the bitwise NEGATE of the Number
bitwiseNegate
(Number
a Number
left
)

Bitwise NEGATE a Number.

public static <T> BufferedIterator<T>

Returns:

a BufferedIterator wrapping self
buffered
(Iterator<T>
an iterator object
self
)

Returns a BufferedIterator that allows examining the next element without consuming it.

public static <T> BufferedIterator<T>

Returns:

a BufferedIterator for traversing self
bufferedIterator
(Iterable<T>
an iterable object
self
)

Returns a BufferedIterator that allows examining the next element without consuming it.

public static <T> BufferedIterator<T>

Returns:

a BufferedIterator for traversing self
bufferedIterator
(List<T>
a list
self
)

Returns a BufferedIterator that allows examining the next element without consuming it.

protected static <T> T
callClosureForLine(Closure<T> closure, String line, int counter)

protected static <T, K, V> T
callClosureForMapEntry(Closure<T> closure, Map.Entry<K, V> entry)

protected static <T, K, V> T
callClosureForMapEntryAndCounter(Closure<T> closure, Map.Entry<K, V> entry, int counter)

public static <T> List<List<T>>

Returns:

a list of lists chopping the original array elements into pieces determined by chopSizes
chop
(T[]
an Array to be chopped
self
,
int...
the sizes for the returned pieces
chopSizes
)

Chops the array into pieces, returning lists with sizes corresponding to the supplied chop sizes.

public static <T> List<List<T>>

Returns:

a list of lists chopping the original iterable into pieces determined by chopSizes
chop
(Iterable<T>
an Iterable to be chopped
self
,
int...
the sizes for the returned pieces
chopSizes
)

Chops the Iterable into pieces, returning lists with sizes corresponding to the supplied chop sizes.

public static <T> List<List<T>>

Returns:

a list of lists chopping the original iterator elements into pieces determined by chopSizes
chop
(Iterator<T>
an Iterator to be chopped
self
,
int...
the sizes for the returned pieces
chopSizes
)

Chops the iterator items into pieces, returning lists with sizes corresponding to the supplied chop sizes.

private static boolean
coercedEquals(Object[] left, List<E> right)

private static boolean
public static <T> List<List<T>>

Returns:

a List containing the data collated into sub-lists
collate
(Iterable<T>
an Iterable
self
,
int
the length of each sub-list in the returned list
size
)

Collates this iterable into sub-lists of length size.

public static <T> List<List<T>>

Returns:

a List containing the array values collated into sub-lists
collate
(T[]
an array
self
,
int
the length of each sub-list in the returned list
size
)

Collates an array.

public static <T> List<List<T>>
collate(List<T> self, int size)

Deprecated use the Iterable variant instead
public static <T> List<List<T>>

Returns:

a List containing the data collated into sub-lists
collate
(Iterable<T>
an Iterable
self
,
int
the length of each sub-list in the returned list
size
,
int
the number of elements to step through for each sub-list
step
)

Collates this iterable into sub-lists of length size stepping through the code step elements for each subList.

public static <T> List<List<T>>

Returns:

a List containing the array elements collated into sub-lists
collate
(T[]
an array
self
,
int
the length of each sub-list in the returned list
size
,
int
the number of elements to step through for each sub-list
step
)

Collates an array into sub-lists.

public static <T> List<List<T>>
collate(List<T> self, int size, int step)

Deprecated use the Iterable variant instead
public static <T> List<List<T>>

Returns:

a List containing the data collated into sub-lists
collate
(Iterable<T>
an Iterable
self
,
int
the length of each sub-list in the returned list
size
,
boolean
if true, any remaining elements are returned as sub-lists. Otherwise they are discarded
keepRemainder
)

Collates this iterable into sub-lists of length size.

public static <T> List<List<T>>

Returns:

a List containing the array elements collated into sub-lists
collate
(T[]
an array
self
,
int
the length of each sub-list in the returned list
size
,
boolean
if true, any remaining elements are returned as sub-lists. Otherwise they are discarded
keepRemainder
)

Collates this array into sub-lists.

public static <T> List<List<T>>
collate(List<T> self, int size, boolean keepRemainder)

Deprecated use the Iterable variant instead
public static <T> List<List<T>>

Returns:

a List containing the data collated into sub-lists
collate
(Iterable<T>
an Iterable
self
,
int
the length of each sub-list in the returned list
size
,
int
the number of elements to step through for each sub-list
step
,
boolean
if true, any remaining elements are returned as sub-lists. Otherwise they are discarded
keepRemainder
)

Collates this iterable into sub-lists of length size stepping through the code step elements for each sub-list.

public static <T> List<List<T>>

Returns:

a List containing the array elements collated into sub-lists
collate
(T[]
an array
self
,
int
the length of each sub-list in the returned list
size
,
int
the number of elements to step through for each sub-list
step
,
boolean
if true, any remaining elements are returned as sub-lists. Otherwise they are discarded
keepRemainder
)

Collates this array into into sub-lists.

public static <T> List<List<T>>
collate(List<T> self, int size, int step, boolean keepRemainder)

Deprecated use the Iterable variant instead
public static Collection<E>

Returns:

a Collection of the transformed values
collect
(Object
an aggregate Object with an Iterator returning its items
self
)

Iterates through this aggregate Object transforming each item into a new value using Closure.IDENTITY as a transformer, basically returning a list of items copied from the original object.

public static <T> List<T>

Returns:

a List of the transformed values
collect
(Object
an aggregate Object with an Iterator returning its items
self
,
Closure<T>
the closure used to transform each item of the aggregate object
transform
)

Iterates through this aggregate Object transforming each item into a new value using the transform closure, returning a list of transformed values.

public static <T> Collection<T>

Returns:

the collector with all transformed values added to it
collect
(Object
an aggregate Object with an Iterator returning its items
self
,
Collection<T>
the Collection to which the transformed values are added
collector
,
Closure<? extends T>
the closure used to transform each item of the aggregate object
transform
)

Iterates through this aggregate Object transforming each item into a new value using the transform closure and adding it to the supplied collector.

public static <S, T> List<T>

Returns:

a List of the transformed values
collect
(S[]
an Array
self
,
Closure<T>
the closure used to transform each item of the Array
transform
)

Iterates through this Array transforming each item into a new value using the transform closure, returning a list of transformed values.

public static <S, T> Collection<T>

Returns:

the collector with all transformed values added to it
collect
(S[]
an Array
self
,
Collection<T>
the Collection to which the transformed values are added
collector
,
Closure<? extends T>
the closure used to transform each item
transform
)

Iterates through this Array transforming each item into a new value using the transform closure and adding it to the supplied collector.

public static <S, T> List<T>

Returns:

a List of the transformed values
collect
(Iterator<S>
an Iterator
self
,
Closure<T>
the closure used to transform each item
transform
)

Iterates through this Iterator transforming each item into a new value using the transform closure, returning a list of transformed values.

public static <S, T> Collection<T>

Returns:

the collector with all transformed values added to it
collect
(Iterator<S>
an Iterator
self
,
Collection<T>
the Collection to which the transformed values are added
collector
,
Closure<? extends T>
the closure used to transform each item
transform
)

Iterates through this Iterator transforming each item into a new value using the transform closure and adding it to the supplied collector.

public static <T> List<T>

Returns:

a List of the transformed values
collect
(Collection<T>
a collection
self
)

Deprecated use the Iterable version instead
Iterates through this collection transforming each entry into a new value using Closure.IDENTITY as a transformer, basically returning a list of items copied from the original collection.
public static <S, T> List<T>

Returns:

a List of the transformed values
collect
(Collection<S>
a collection
self
,
Closure<T>
the closure used to transform each item of the collection
transform
)

Deprecated use the Iterable version instead
Iterates through this collection transforming each entry into a new value using the transform closure returning a list of transformed values.
public static <S, T> Collection<T>

Returns:

the collector with all transformed values added to it
collect
(Collection<S>
a collection
self
,
Collection<T>
the Collection to which the transformed values are added
collector
,
Closure<? extends T>
the closure used to transform each item of the collection
transform
)

Deprecated use the Iterable version instead
Iterates through this collection transforming each value into a new value using the transform closure and adding it to the supplied collector.
public static <T> List<T>

Returns:

a List of the transformed values
collect
(Iterable<T>
an Iterable
self
)

Iterates through this collection transforming each entry into a new value using Closure.IDENTITY as a transformer, basically returning a list of items copied from the original collection.

public static <S, T> List<T>

Returns:

a List of the transformed values
collect
(Iterable<S>
an Iterable
self
,
Closure<T>
the closure used to transform each item of the collection
transform
)

Iterates through this Iterable transforming each entry into a new value using the transform closure returning a list of transformed values.

public static <S, T> Collection<T>

Returns:

the collector with all transformed values added to it
collect
(Iterable<S>
an Iterable
self
,
Collection<T>
the Collection to which the transformed values are added
collector
,
Closure<? extends T>
the closure used to transform each item
transform
)

Iterates through this collection transforming each value into a new value using the transform closure and adding it to the supplied collector.

public static <T, K, V> Collection<T>

Returns:

the collector with all transformed values added to it
collect
(Map<K, V>
a Map
self
,
Collection<T>
the Collection to which transformed values are added
collector
,
Closure<? extends T>
the transformation closure which can take one (Map.Entry) or two (key, value) parameters
transform
)

Iterates through this Map transforming each map entry into a new value using the transform closure returning the collector with all transformed values added to it.

public static <T, K, V> List<T>

Returns:

the resultant list of transformed values
collect
(Map<K, V>
a Map
self
,
Closure<T>
the transformation closure which can take one (Map.Entry) or two (key, value) parameters
transform
)

Iterates through this Map transforming each map entry into a new value using the transform closure returning a list of transformed values.

public static List<E>
collectAll(Collection<E> self, Closure<V> transform)

Deprecated Use collectNested instead
Deprecated alias for collectNested
public static Collection<E>
collectAll(Collection<E> self, Collection<E> collector, Closure<V> transform)

Deprecated Use collectNested instead
Deprecated alias for collectNested
public static <K, V, X, Y> Map<K, V>

Returns:

the collector with all transformed values added to it
collectEntries
(Map<X, Y>
a Map
self
,
Map<K, V>
the Map into which the transformed entries are put
collector
,
Closure<?>
the closure used for transforming, which can take one (Map.Entry) or two (key, value) parameters and should return a Map.Entry, a Map or a two-element list containing the resulting key and value
transform
)

Iterates through this Map transforming each map entry using the transform closure returning a map of the transformed entries.

public static <K, V, X, Y> Map<K, V>

Returns:

a Map of the transformed entries
collectEntries
(Map<X, Y>
a Map
self
,
Closure<?>
the closure used for transforming, which can take one (Map.Entry) or two (key, value) parameters and should return a Map.Entry, a Map or a two-element list containing the resulting key and value
transform
)

Iterates through this Map transforming each entry using the transform closure and returning a map of the transformed entries.

public static <K, V> Map<K, V>
collectEntries(Collection<?> self, Closure<?> transform)

Deprecated Use the Iterable version of collectEntries instead
public static <K, V, E> Map<K, V>

Returns:

a Map of the transformed entries
collectEntries
(Iterator<E>
an Iterator
self
,
Closure<?>
the closure used for transforming, which has an item from self as the parameter and should return a Map.Entry, a Map or a two-element list containing the resulting key and value
transform
)

A variant of collectEntries for Iterators.

public static <K, V, E> Map<K, V>

Returns:

a Map of the transformed entries
collectEntries
(Iterable<E>
an Iterable
self
,
Closure<?>
the closure used for transforming, which has an item from self as the parameter and should return a Map.Entry, a Map or a two-element list containing the resulting key and value
transform
)

Iterates through this Iterable transforming each item using the transform closure and returning a map of the resulting transformed entries.

public static <K, V> Map<K, V>
collectEntries(Collection<?> self)

Deprecated Use the Iterable version of collectEntries instead
public static <K, V> Map<K, V>

Returns:

a Map of the transformed entries
collectEntries
(Iterator<?>
an Iterator
self
)

A variant of collectEntries for Iterators using the identity closure as the transform.

public static <K, V> Map<K, V>

Returns:

a Map of the transformed entries
collectEntries
(Iterable<?>
an Iterable
self
)

A variant of collectEntries for Iterable objects using the identity closure as the transform.

public static <K, V> Map<K, V>
collectEntries(Collection<?> self, Map<K, V> collector, Closure<?> transform)

Deprecated Use the Iterable version of collectEntries instead
public static <K, V, E> Map<K, V>

Returns:

the collector with all transformed values added to it
collectEntries
(Iterator<E>
an Iterator
self
,
Map<K, V>
the Map into which the transformed entries are put
collector
,
Closure<?>
the closure used for transforming, which has an item from self as the parameter and should return a Map.Entry, a Map or a two-element list containing the resulting key and value
transform
)

A variant of collectEntries for Iterators using a supplied map as the destination of transformed entries.

public static <K, V, E> Map<K, V>

Returns:

the collector with all transformed values added to it
collectEntries
(Iterable<E>
an Iterable
self
,
Map<K, V>
the Map into which the transformed entries are put
collector
,
Closure<?>
the closure used for transforming, which has an item from self as the parameter and should return a Map.Entry, a Map or a two-element list containing the resulting key and value
transform
)

Iterates through this Iterable transforming each item using the closure as a transformer into a map entry, returning the supplied map with all of the transformed entries added to it.

public static <K, V> Map<K, V>
collectEntries(Collection<?> self, Map<K, V> collector)

Deprecated Use the Iterable version of collectEntries instead
public static <K, V> Map<K, V>

Returns:

the collector with all transformed values added to it
collectEntries
(Iterator<?>
an Iterator
self
,
Map<K, V>
the Map into which the transformed entries are put
collector
)

A variant of collectEntries for Iterators using the identity closure as the transform and a supplied map as the destination of transformed entries.

public static <K, V> Map<K, V>

Returns:

the collector with all transformed values added to it
collectEntries
(Iterable<?>
an Iterable
self
,
Map<K, V>
the Map into which the transformed entries are put
collector
)

A variant of collectEntries for Iterables using the identity closure as the transform and a supplied map as the destination of transformed entries.

public static <K, V, E> Map<K, V>

Returns:

the collector with all transformed values added to it
collectEntries
(E[]
an array
self
,
Map<K, V>
the Map into which the transformed entries are put
collector
,
Closure<?>
the closure used for transforming, which has an item from self as the parameter and should return a Map.Entry, a Map or a two-element list containing the resulting key and value
transform
)

Iterates through this array transforming each item using the transform closure and returning a map of the resulting transformed entries.

public static <K, V, E> Map<K, V>

Returns:

the collector with all transformed values added to it
collectEntries
(E[]
an array
self
,
Map<K, V>
the Map into which the transformed entries are put
collector
)

A variant of collectEntries using the identity closure as the transform.

public static <K, V, E> Map<K, V>

Returns:

a Map of the transformed entries
collectEntries
(E[]
a Collection
self
,
Closure<?>
the closure used for transforming, which has an item from self as the parameter and should return a Map.Entry, a Map or a two-element list containing the resulting key and value
transform
)

Iterates through this array transforming each item using the transform closure and returning a map of the resulting transformed entries.

public static <K, V, E> Map<K, V>

Returns:

the collector with all transformed values added to it
collectEntries
(E[]
an array
self
)

A variant of collectEntries using the identity closure as the transform.

public static <T, E> List<T>
collectMany(Collection<E> self, Closure<? extends Collection<? extends T>> projection)

Deprecated Use the Iterable version of collectMany instead
public static <T, E> Collection<T>
collectMany(Collection<E> self, Collection<T> collector, Closure<? extends Collection<? extends T>> projection)

Deprecated Use the Iterable version of collectMany instead
public static <T, E> List<T>

Returns:

a list created from the projected collections concatenated (flattened) together
collectMany
(Iterable<E>
an Iterable
self
,
Closure<? extends Collection<? extends T>>
a projecting Closure returning a collection of items
projection
)

Projects each item from a source Iterable to a collection and concatenates (flattens) the resulting collections into a single list.

public static <T, E> Collection<T>

Returns:

the collector with the projected collections concatenated (flattened) into it
collectMany
(Iterable<E>
an Iterable
self
,
Collection<T>
an initial collection to add the projected items to
collector
,
Closure<? extends Collection<? extends T>>
a projecting Closure returning a collection of items
projection
)

Projects each item from a source collection to a result collection and concatenates (flattens) the resulting collections adding them into the collector.

public static <T, K, V> Collection<T>

Returns:

the collector with the projected collections concatenated (flattened) to it
collectMany
(Map<K, V>
a map
self
,
Collection<T>
an initial collection to add the projected items to
collector
,
Closure<? extends Collection<? extends T>>
a projecting Closure returning a collection of items
projection
)

Projects each item from a source map to a result collection and concatenates (flattens) the resulting collections adding them into the collector.

public static <T, K, V> List<T>

Returns:

a list created from the projected collections concatenated (flattened) together
collectMany
(Map<K, V>
a map
self
,
Closure<? extends Collection<? extends T>>
a projecting Closure returning a collection of items
projection
)

Projects each item from a source map to a result collection and concatenates (flattens) the resulting collections adding them into a collection.

public static <T, E> List<T>

Returns:

a list created from the projected collections concatenated (flattened) together
collectMany
(E[]
an array
self
,
Closure<? extends Collection<? extends T>>
a projecting Closure returning a collection of items
projection
)

Projects each item from a source array to a collection and concatenates (flattens) the resulting collections into a single list.

public static <T, E> Collection<T>

Returns:

the collector with the projected collections concatenated (flattened) to it
collectMany
(E[]
an array
self
,
Collection<T>
an initial collection to add the projected items to
collector
,
Closure<? extends Collection<? extends T>>
a projecting Closure returning a collection of items
projection
)

Projects each item from a source array to a collection and concatenates (flattens) the resulting collections into a single list.

public static <T, E> Collection<T>

Returns:

the collector with the projected collections concatenated (flattened) to it
collectMany
(Iterator<E>
an iterator
self
,
Collection<T>
an initial collection to add the projected items to
collector
,
Closure<? extends Collection<? extends T>>
a projecting Closure returning a collection of items
projection
)

Projects each item from a source iterator to a collection and concatenates (flattens) the resulting collections into a single list.

public static <T, E> List<T>

Returns:

a list created from the projected collections concatenated (flattened) together
collectMany
(Iterator<E>
an iterator
self
,
Closure<? extends Collection<? extends T>>
a projecting Closure returning a collection of items
projection
)

Projects each item from a source iterator to a collection and concatenates (flattens) the resulting collections into a single list.

public static <T, K, V> Collection<T>
collectMany$$bridge(Map<K, V> self, Closure<? extends Collection<? extends T>> projection)

Deprecated
public static List<E>

Returns:

the resultant collection
collectNested
(Collection<E>
a collection
self
,
Closure<V>
the closure used to transform each item of the collection
transform
)

Recursively iterates through this collection transforming each non-Collection value into a new value using the closure as a transformer.

public static List<E>

Returns:

the resultant list
collectNested
(Iterable<T>
an Iterable
self
,
Closure<V>
the closure used to transform each item of the Iterable
transform
)

Recursively iterates through this Iterable transforming each non-Collection value into a new value using the closure as a transformer.

public static Collection<E>
collectNested(Collection<E> self, Collection<E> collector, Closure<V> transform)

Deprecated Use the Iterable version of collectNested instead
public static Collection<E>

Returns:

the collector with all transformed values added to it
collectNested
(Iterable<T>
an Iterable
self
,
Collection<E>
an initial Collection to which the transformed values are added
collector
,
Closure<V>
the closure used to transform each element of the Iterable
transform
)

Recursively iterates through this Iterable transforming each non-Collection value into a new value using the transform closure.

public static List<E>
combinations(Collection<E> self)

Deprecated Use the Iterable version of combinations instead
public static List<E>

Returns:

a List of the combinations found
combinations
(Iterable<T>
an Iterable of collections
self
)

Adds GroovyCollections#combinations(Iterable) as a method on Iterables.

public static List<E>

Returns:

a List of the results of applying the closure to each combinations found
combinations
(Iterable<T>
a Collection of lists
self
,
Closure<?>
a closure to be called on each combination
function
)

Adds GroovyCollections#combinations(Iterable, Closure) as a method on collections.

public static int

Returns:

the result of the comparison
compareTo
(Character
a Character
left
,
Number
a Number
right
)

Compare a Character and a Number.

public static int

Returns:

the result of the comparison
compareTo
(Number
a Number
left
,
Character
a Character
right
)

Compare a Number and a Character.

public static int

Returns:

the result of the comparison
compareTo
(Character
a Character
left
,
Character
a Character
right
)

Compare two Characters.

public static int

Returns:

the comparison of both numbers
compareTo
(Number
a Number
left
,
Number
another Number to compare to
right
)

Compare two Numbers.

public static boolean

Returns:

true if this iterable contains the item
contains
(Iterable<T>
an Iterable to be checked for containment
self
,
Object
an Object to be checked for containment in this iterable
item
)

Returns true if this iterable contains the item.

public static boolean

Returns:

true if the array contains the value
contains
(int[]
the array we are searching
self
,
Object
the value being searched for
value
)

Checks whether the array contains the given value.

public static boolean

Returns:

true if the array contains the value
contains
(long[]
the array we are searching
self
,
Object
the value being searched for
value
)

Checks whether the array contains the given value.

public static boolean

Returns:

true if the array contains the value
contains
(short[]
the array we are searching
self
,
Object
the value being searched for
value
)

Checks whether the array contains the given value.

public static boolean

Returns:

true if the array contains the value
contains
(char[]
the array we are searching
self
,
Object
the value being searched for
value
)

Checks whether the array contains the given value.

public static boolean

Returns:

the number of occurrences
contains
(boolean[]
the array within which we count the number of occurrences
self
,
Object
the value being searched for
value
)

Checks whether the array contains the given value.

public static boolean

Returns:

true if the array contains the value
contains
(double[]
the array we are searching
self
,
Object
the value being searched for
value
)

Checks whether the array contains the given value.

public static boolean

Returns:

true if the array contains the value
contains
(float[]
the array we are searching
self
,
Object
the value being searched for
value
)

Checks whether the array contains the given value.

public static boolean

Returns:

true if the array contains the value
contains
(byte[]
the array we are searching
self
,
Object
the value being searched for
value
)

Checks whether the array contains the given value.

public static boolean

Returns:

true if the array contains the value
contains
(Object[]
the array we are searching
self
,
Object
the value being searched for
value
)

Checks whether the array contains the given value.

public static boolean

Returns:

true if this collection contains all of the elements in the specified array
containsAll
(Iterable<T>
an Iterable to be checked for containment
self
,
Object[]
array to be checked for containment in this iterable
items
)

Returns true if this iterable contains all of the elements in the specified array.

public static boolean
containsAll(Collection<E> self, Object[] items)

Deprecated use the Iterable variant instead
public static Number

Returns:

the number of occurrences
count
(Iterator<E>
the Iterator from which we count the number of matching occurrences
self
,
Object
the value being searched for
value
)

Counts the number of occurrences of the given value from the items within this Iterator.

public static <T> Number

Returns:

the number of occurrences
count
(Iterator<T>
the Iterator from which we count the number of matching occurrences
self
,
Closure<V>
a closure condition
closure
)

Counts the number of occurrences which satisfy the given closure from the items within this Iterator.

public static Number
count(Collection<E> self, Object value)

Deprecated use count(Iterable, Closure)
public static Number

Returns:

the number of occurrences
count
(Iterable<T>
the Iterable within which we count the number of occurrences
self
,
Object
the value being searched for
value
)

Counts the number of occurrences of the given value inside this Iterable.

public static Number
count(Collection<E> self, Closure<V> closure)

Deprecated use count(Iterable, Closure)
public static <T> Number

Returns:

the number of occurrences
count
(Iterable<T>
the Iterable within which we count the number of occurrences
self
,
Closure<V>
a closure condition
closure
)

Counts the number of occurrences which satisfy the given closure from inside this Iterable.

public static <K, V> Number

Returns:

the number of occurrences
count
(Map<K, V>
the map within which we count the number of occurrences
self
,
Closure<?>
a 1 or 2 arg Closure condition applying on the entries
closure
)

Counts the number of occurrences which satisfy the given closure from inside this map.

public static Number

Returns:

the number of occurrences
count
(Object[]
the array within which we count the number of occurrences
self
,
Object
the value being searched for
value
)

Counts the number of occurrences of the given value inside this array.

public static <T> Number

Returns:

the number of occurrences
count
(T[]
the array within which we count the number of occurrences
self
,
Closure<V>
a closure condition
closure
)

Counts the number of occurrences which satisfy the given closure from inside this array.

public static Number

Returns:

the number of occurrences
count
(int[]
the array within which we count the number of occurrences
self
,
Object
the value being searched for
value
)

Counts the number of occurrences of the given value inside this array.

public static Number

Returns:

the number of occurrences
count
(long[]
the array within which we count the number of occurrences
self
,
Object
the value being searched for
value
)

Counts the number of occurrences of the given value inside this array.

public static Number

Returns:

the number of occurrences
count
(short[]
the array within which we count the number of occurrences
self
,
Object
the value being searched for
value
)

Counts the number of occurrences of the given value inside this array.

public static Number

Returns:

the number of occurrences
count
(char[]
the array within which we count the number of occurrences
self
,
Object
the value being searched for
value
)

Counts the number of occurrences of the given value inside this array.

public static Number

Returns:

the number of occurrences
count
(boolean[]
the array within which we count the number of occurrences
self
,
Object
the value being searched for
value
)

Counts the number of occurrences of the given value inside this array.

public static Number

Returns:

the number of occurrences
count
(double[]
the array within which we count the number of occurrences
self
,
Object
the value being searched for
value
)

Counts the number of occurrences of the given value inside this array.

public static Number

Returns:

the number of occurrences
count
(float[]
the array within which we count the number of occurrences
self
,
Object
the value being searched for
value
)

Counts the number of occurrences of the given value inside this array.

public static Number

Returns:

the number of occurrences
count
(byte[]
the array within which we count the number of occurrences
self
,
Object
the value being searched for
value
)

Counts the number of occurrences of the given value inside this array.

private static <T> void
countAnswer(final Map<T, Integer> answer, T mappedKey)

public static <K> Map<K, Integer>
countBy(Collection<E> self, Closure<K> closure)

Deprecated Use the Iterable version of countBy instead
public static <K, E> Map<K, Integer>

Returns:

a new Map grouped by keys with frequency counts
countBy
(Iterable<E>
a collection to group and count
self
,
Closure<K>
a closure mapping items to the frequency keys
closure
)

Sorts all collection members into groups determined by the supplied mapping closure and counts the group size.

public static <K, E> Map<K, Integer>

Returns:

a new Map grouped by keys with frequency counts
countBy
(E[]
an array to group and count
self
,
Closure<K>
a closure mapping items to the frequency keys
closure
)

Sorts all array members into groups determined by the supplied mapping closure and counts the group size.

public static <K, E> Map<K, Integer>

Returns:

a new Map grouped by keys with frequency counts
countBy
(Iterator<E>
an iterator to group and count
self
,
Closure<K>
a closure mapping items to the frequency keys
closure
)

Sorts all iterator items into groups determined by the supplied mapping closure and counts the group size.

public static <K, U, V> Map<K, Integer>

Returns:

a new Map grouped by keys with frequency counts
countBy
(Map<U, V>
a map to group and count
self
,
Closure<K>
a closure mapping entries to frequency count keys
closure
)

Groups the members of a map into groups determined by the supplied mapping closure and counts the frequency of the created groups.

private static void
public static boolean

Returns:

boolean true if the intersection of two iterables is empty, false otherwise.
disjoint
(Iterable<T>
an Iterable
left
,
Iterable<T>
an Iterable
right
)

Returns true if the intersection of two iterables is empty.

public static boolean
disjoint(Collection<E> left, Collection<E> right)

Deprecated use the Iterable variant instead
public static Number

Returns:

the Number corresponding to the division of left by right
div
(Character
a Character
left
,
Number
a Number
right
)

Divide a Character by a Number.

public static Number

Returns:

the Number corresponding to the division of left by right
div
(Number
a Number
left
,
Character
a Character
right
)

Divide a Number by a Character.

public static Number

Returns:

the Number corresponding to the division of left by right
div
(Character
a Character
left
,
Character
another Character
right
)

Divide one Character by another.

public static void
downto(Number
a Number
self
,
Number
another Number to go down to
to
,
Closure<V>
the closure to call
closure
)

Iterates from this number down to the given number, inclusive, decrementing by one each time.

public static void
downto(long
a long
self
,
Number
the end number
to
,
Closure<V>
the code to execute for each number
closure
)

Iterates from this number down to the given number, inclusive, decrementing by one each time.

public static void
downto(Long
a Long
self
,
Number
the end number
to
,
Closure<V>
the code to execute for each number
closure
)

Iterates from this number down to the given number, inclusive, decrementing by one each time.

public static void
downto(float
a float
self
,
Number
the end number
to
,
Closure<V>
the code to execute for each number
closure
)

Iterates from this number down to the given number, inclusive, decrementing by one each time.

public static void
downto(Float
a Float
self
,
Number
the end number
to
,
Closure<V>
the code to execute for each number
closure
)

Iterates from this number down to the given number, inclusive, decrementing by one each time.

public static void
downto(double
a double
self
,
Number
the end number
to
,
Closure<V>
the code to execute for each number
closure
)

Iterates from this number down to the given number, inclusive, decrementing by one each time.

public static void
downto(Double
a Double
self
,
Number
the end number
to
,
Closure<V>
the code to execute for each number
closure
)

Iterates from this number down to the given number, inclusive, decrementing by one each time.

public static void
downto(BigInteger
a BigInteger
self
,
Number
the end number
to
,
Closure<V>
the code to execute for each number
closure
)

Iterates from this number down to the given number, inclusive, decrementing by one each time.

public static void
downto(BigDecimal
a BigDecimal
self
,
Number
the end number
to
,
Closure<V>
the code to execute for each number
closure
)

Iterates from this number down to the given number, inclusive, decrementing by one each time.

public static <T> SortedSet<T>

Returns:

a SortedSet consisting of all the elements of this Iterable minus the first num elements, or an empty list if it has less then num elements.
drop
(SortedSet<T>
the original SortedSet
self
,
int
the number of elements to drop from this Iterable
num
)

Drops the given number of elements from the head of this List.

public static <T> List<T>

Returns:

a List consisting of all the elements of this Iterable minus the first num elements, or an empty list if it has less then num elements.
drop
(List<T>
the original List
self
,
int
the number of elements to drop from this Iterable
num
)

Drops the given number of elements from the head of this List.

public static <T> Collection<T>

Returns:

a Collection consisting of all the elements of this Iterable minus the first num elements, or an empty list if it has less then num elements.
drop
(Iterable<T>
the original Iterable
self
,
int
the number of elements to drop from this Iterable
num
)

Drops the given number of elements from the head of this Iterable.

public static <T> T[]

Returns:

an array consisting of all elements of this array except the first num ones, or else the empty array, if this array has less than num elements.
drop
(T[]
the original array
self
,
int
the number of elements to drop from this array
num
)

Drops the given number of elements from the head of this array if they are available.

public static <K, V> Map<K, V>

Returns:

a map consisting of all key/value pairs of this map except the first num ones, or else the empty map, if this map has less than num elements.
drop
(Map<K, V>
the original map
self
,
int
the number of elements to drop from this map
num
)

Drops the given number of key/value pairs from the head of this map if they are available.

public static <T> Iterator<T>

Returns:

The iterator stepped along by num elements if they exist.
drop
(Iterator<T>
the original iterator
self
,
int
the number of elements to drop from this iterator
num
)

Drops the given number of elements from the head of this iterator if they are available.

public static <T> SortedSet<T>

Returns:

a List consisting of all the elements of this SortedSet minus the last num elements, or an empty SortedSet if it has less then num elements.
dropRight
(SortedSet<T>
the original SortedSet
self
,
int
the number of elements to drop from this SortedSet
num
)

Drops the given number of elements from the tail of this SortedSet.

public static <T> List<T>

Returns:

a List consisting of all the elements of this List minus the last num elements, or an empty List if it has less then num elements.
dropRight
(List<T>
the original List
self
,
int
the number of elements to drop from this List
num
)

Drops the given number of elements from the tail of this List.

public static <T> Collection<T>

Returns:

a Collection consisting of all the elements of this Iterable minus the last num elements, or an empty list if it has less then num elements.
dropRight
(Iterable<T>
the original Iterable
self
,
int
the number of elements to drop from this Iterable
num
)

Drops the given number of elements from the tail of this Iterable.

public static <T> Iterator<T>

Returns:

an Iterator consisting of all the elements of this Iterator minus the last num elements, or an empty Iterator if it has less then num elements.
dropRight
(Iterator<T>
the original Iterator
self
,
int
the number of elements to drop
num
)

Drops the given number of elements from the tail of this Iterator.

public static <T> T[]

Returns:

an array consisting of all elements of this array except the last num ones, or else the empty array, if this array has less than num elements.
dropRight
(T[]
the original array
self
,
int
the number of elements to drop from this array
num
)

Drops the given number of elements from the tail of this array if they are available.

public static <T> SortedSet<T>

Returns:

the shortest suffix of the given SortedSet such that the given closure condition evaluates to true for each element dropped from the front of the SortedSet
dropWhile
(SortedSet<T>
the original SortedSet
self
,
Closure<V>
the closure that must evaluate to true to continue dropping elements
condition
)

Returns a suffix of this SortedSet where elements are dropped from the front while the given Closure evaluates to true.

public static <T> List<T>

Returns:

the shortest suffix of the given List such that the given closure condition evaluates to true for each element dropped from the front of the List
dropWhile
(List<T>
the original list
self
,
Closure<V>
the closure that must evaluate to true to continue dropping elements
condition
)

Returns a suffix of this List where elements are dropped from the front while the given Closure evaluates to true.

public static <T> Collection<T>

Returns:

a Collection containing the shortest suffix of the given Iterable such that the given closure condition evaluates to true for each element dropped from the front of the Iterable
dropWhile
(Iterable<T>
an Iterable
self
,
Closure<V>
the closure that must evaluate to true to continue dropping elements
condition
)

Returns a suffix of this Iterable where elements are dropped from the front while the given closure evaluates to true.

public static <K, V> Map<K, V>

Returns:

the shortest suffix of the given Map such that the given closure condition evaluates to true for each element dropped from the front of the Map
dropWhile
(Map<K, V>
a Map
self
,
Closure<V>
a 1 (or 2) arg Closure that must evaluate to true for the entry (or key and value) to continue dropping elements
condition
)

Create a suffix of the given Map by dropping as many entries as possible from the front of the original Map such that calling the given closure condition evaluates to true when passed each of the dropped entries (or key/value pairs).

public static <T> T[]

Returns:

the shortest suffix of the given array such that the given closure condition evaluates to true for each element dropped from the front of the array
dropWhile
(T[]
the original array
self
,
Closure<?>
the closure that must evaluate to true to continue dropping elements
condition
)

Create a suffix of the given array by dropping as many elements as possible from the front of the original array such that calling the given closure condition evaluates to true when passed each of the dropped elements.

public static <T> Iterator<T>

Returns:

the shortest suffix of elements from the given Iterator such that the given closure condition evaluates to true for each element dropped from the front of the Iterator
dropWhile
(Iterator<T>
the Iterator
self
,
Closure<?>
the closure that must evaluate to true to continue dropping elements
condition
)

Creates an Iterator that returns a suffix of the elements from an original Iterator.

public static String

Returns:

the dump representation
dump
(Object
an object
self
)

Generates a detailed dump string of an object showing its class, hashCode and fields.

public static <T> T[]

Returns:

the self array
each
(T[]
the array over which we iterate
self
,
Closure<V>
the closure applied on each array entry
closure
)

Iterates through an array passing each array entry to the given closure.

public static <T> T

Returns:

the self Object
each
(T
the object over which we iterate
self
,
Closure<V>
the closure applied on each element found
closure
)

Iterates through an aggregate type or data structure, passing each item to the given closure.

public static <T> Iterable<T>

Returns:

the self Iterable
each
(Iterable<T>
the Iterable over which we iterate
self
,
Closure<V>
the closure applied on each element found
closure
)

Iterates through an Iterable, passing each item to the given closure.

public static <T> Iterator<T>

Returns:

the self Iterator
each
(Iterator<T>
the Iterator over which we iterate
self
,
Closure<V>
the closure applied on each element found
closure
)

Iterates through an Iterator, passing each item to the given closure.

public static <T> Collection<T>

Returns:

the self Collection
each
(Collection<T>
the Collection over which we iterate
self
,
Closure<V>
the closure applied on each element found
closure
)

Iterates through a Collection, passing each item to the given closure.

public static <T> List<T>

Returns:

the self List
each
(List<T>
the List over which we iterate
self
,
Closure<V>
the closure applied on each element found
closure
)

Iterates through a List, passing each item to the given closure.

public static <T> Set<T>

Returns:

the self Set
each
(Set<T>
the Set over which we iterate
self
,
Closure<V>
the closure applied on each element found
closure
)

Iterates through a Set, passing each item to the given closure.

public static <T> SortedSet<T>

Returns:

the self SortedSet
each
(SortedSet<T>
the SortedSet over which we iterate
self
,
Closure<V>
the closure applied on each element found
closure
)

Iterates through a SortedSet, passing each item to the given closure.

public static <K, V> Map<K, V>

Returns:

returns the self parameter
each
(Map<K, V>
the map over which we iterate
self
,
Closure<V>
the 1 or 2 arg closure applied on each entry of the map
closure
)

Allows a Map to be iterated through using a closure.

public static void
eachByte(Byte[]
a Byte array
self
,
Closure<V>
a closure
closure
)

Traverse through each byte of this Byte array.

public static void
eachByte(byte[]
a byte array
self
,
Closure<V>
a closure
closure
)

Traverse through each byte of this byte array.

public static void
eachCombination(Iterable<T>
a Collection of lists
self
,
Closure<?>
a closure to be called on each combination
function
)

Applies a function on each combination of the input lists.

public static <T> Iterator<List<T>>
eachPermutation(Collection<T> self, Closure<V> closure)

Deprecated Use the Iterable version of eachPermutation instead
public static <T> Iterator<List<T>>

Returns:

the permutations from the list
eachPermutation
(Iterable<T>
the Collection of items
self
,
Closure<V>
the closure to call for each permutation
closure
)

Iterates over all permutations of a collection, running a closure for each iteration.

public static <T> T[]

Returns:

the self array
eachWithIndex
(T[]
an array
self
,
Closure<V>
a Closure to operate on each array entry
closure
)

Iterates through an array, passing each array element and the element's index (a counter starting at zero) to the given closure.

public static <T> T

Returns:

the self Object
eachWithIndex
(T
an Object
self
,
Closure<V>
a Closure to operate on each item
closure
)

Iterates through an aggregate type or data structure, passing each item and the item's index (a counter starting at zero) to the given closure.

public static <T> Iterable<T>

Returns:

the self Iterable
eachWithIndex
(Iterable<T>
an Iterable
self
,
Closure<V>
a Closure to operate on each item
closure
)

Iterates through an iterable type, passing each item and the item's index (a counter starting at zero) to the given closure.

public static <T> Iterator<T>

Returns:

the self Iterator (now exhausted)
eachWithIndex
(Iterator<T>
an Iterator
self
,
Closure<V>
a Closure to operate on each item
closure
)

Iterates through an iterator type, passing each item and the item's index (a counter starting at zero) to the given closure.

public static <T> Collection<T>

Returns:

the self Collection
eachWithIndex
(Collection<T>
a Collection
self
,
Closure<V>
a Closure to operate on each item
closure
)

Iterates through a Collection, passing each item and the item's index (a counter starting at zero) to the given closure.

public static <T> List<T>

Returns:

the self List
eachWithIndex
(List<T>
a List
self
,
Closure<V>
a Closure to operate on each item
closure
)

Iterates through a List, passing each item and the item's index (a counter starting at zero) to the given closure.

public static <T> Set<T>

Returns:

the self Set
eachWithIndex
(Set<T>
a Set
self
,
Closure<V>
a Closure to operate on each item
closure
)

Iterates through a Set, passing each item and the item's index (a counter starting at zero) to the given closure.

public static <T> SortedSet<T>

Returns:

the self SortedSet
eachWithIndex
(SortedSet<T>
a SortedSet
self
,
Closure<V>
a Closure to operate on each item
closure
)

Iterates through a SortedSet, passing each item and the item's index (a counter starting at zero) to the given closure.

public static <K, V> Map<K, V>

Returns:

the self Object
eachWithIndex
(Map<K, V>
the map over which we iterate
self
,
Closure<V>
a 2 or 3 arg Closure to operate on each item
closure
)

Allows a Map to be iterated through using a closure.

public static boolean

Returns:

true if the contents of both arrays are equal.
equals
(int[]
an int array
left
,
int[]
the array being compared
right
)

Compare the contents of this array to the contents of the given array.

public static boolean

Returns:

true if the contents of both collections are equal
equals
(Object[]
an array
left
,
List<E>
the List being compared
right
)

Determines if the contents of this array are equal to the contents of the given list, in the same order.

public static boolean

Returns:

true if the contents of both collections are equal
equals
(List<E>
a List
left
,
Object[]
the Object[] being compared to
right
)

Determines if the contents of this list are equal to the contents of the given array in the same order.

public static boolean

Returns:

boolean true if the contents of both lists are identical, false otherwise.
equals
(List<E>
a List
left
,
List<E>
the List being compared to
right
)

Compare the contents of two Lists.

public static <T> boolean

Returns:

true if the contents of both sets are identical
equals
(Set<T>
a Set
self
,
Set<T>
the Set being compared to
other
)

Compare the contents of two Sets for equality using Groovy's coercion rules.

public static boolean

Returns:

true if the contents of both maps are identical
equals
(Map<K, V>
this Map
self
,
Map<K, V>
the Map being compared to
other
)

Compares two Maps treating coerced numerical values as identical.

public static boolean
equalsIgnoreZeroSign(Float number, Object other)

Compares this object against the specified object returning the same result as Float#equals(Object) but returning true if this object and the specified object are both zero and negative zero respectively or vice versa.

public static boolean
equalsIgnoreZeroSign(Double number, Object other)

Compares this object against the specified object returning the same result as Double#equals(Object) but returning true if this object and the specified object are both zero and negative zero respectively or vice versa.

public static boolean

Returns:

true if every iteration of the object matches the closure predicate
every
(Object
the object over which we iterate
self
,
Closure<V>
the closure predicate used for matching
predicate
)

Used to determine if the given predicate closure is valid (i.e. returns true for all items in this data structure).

public static <T> boolean

Returns:

true if every iteration of the object matches the closure predicate
every
(Iterator<T>
the iterator over which we iterate
self
,
Closure<V>
the closure predicate used for matching
predicate
)

Used to determine if the given predicate closure is valid (i.e. returns true for all items in this iterator).

public static <T> boolean

Returns:

true if every element of the Array matches the closure predicate
every
(T[]
an Array
self
,
Closure<V>
the closure predicate used for matching
predicate
)

Used to determine if the given predicate closure is valid (i.e. returns true for all items in this Array).

public static <T> boolean

Returns:

true if every iteration of the object matches the closure predicate
every
(Iterable<T>
the iterable over which we iterate
self
,
Closure<V>
the closure predicate used for matching
predicate
)

Used to determine if the given predicate closure is valid (i.e. returns true for all items in this iterable).

public static <K, V> boolean

Returns:

true if every entry of the map matches the closure predicate
every
(Map<K, V>
the map over which we iterate
self
,
Closure<V>
the 1 or 2 arg Closure predicate used for matching
predicate
)

Iterates over the entries of a map, and checks whether a predicate is valid for all entries.

public static boolean

Returns:

true if every item in the collection matches satisfies Groovy truth
every
(Object
the object over which we iterate
self
)

Iterates over every element of a collection, and checks whether all elements are true according to the Groovy Truth.

public static Object

Returns:

the first Object found or null if none was found
find
(Object
an Object with an iterator returning its values
self
,
Closure<V>
a closure condition
closure
)

Finds the first value matching the closure condition.

public static Object

Returns:

the first Object found or null if none was found
find
(Object
an Object with an Iterator returning its values
self
)

Finds the first item matching the IDENTITY Closure (i.e. matching Groovy truth).

public static <T> T

Returns:

the first Object found, in the order of the collections iterator, or null if no element matches
find
(Collection<T>
a Collection
self
,
Closure<V>
a closure condition
closure
)

Finds the first value matching the closure condition.

public static <T> T

Returns:

the first element from the array that matches the condition or null if no element matches
find
(T[]
an Array
self
,
Closure<V>
a closure condition
condition
)

Finds the first element in the array that matches the given closure condition.

public static <T> T

Returns:

the first Object found or null if none was found
find
(Collection<T>
a Collection
self
)

Finds the first item matching the IDENTITY Closure (i.e. matching Groovy truth).

public static <K, V> Map.Entry<K, V>

Returns:

the first Object found
find
(Map<K, V>
a Map
self
,
Closure<?>
a 1 or 2 arg Closure condition
closure
)

Finds the first entry matching the closure condition.

public static <T> Set<T>

Returns:

a Set of matching values
findAll
(Set<T>
a Set
self
,
Closure<V>
a closure condition
closure
)

Finds all values matching the closure condition.

public static <T> List<T>

Returns:

a List of matching values
findAll
(List<T>
a List
self
,
Closure<V>
a closure condition
closure
)

Finds all values matching the closure condition.

public static <T> Collection<T>

Returns:

a Collection of matching values
findAll
(Collection<T>
a Collection
self
,
Closure<V>
a closure condition
closure
)

Finds all values matching the closure condition.

public static <T> Collection<T>

Returns:

a list of matching values
findAll
(T[]
an array
self
,
Closure<V>
a closure condition
condition
)

Finds all elements of the array matching the given Closure condition.

public static <T> Set<T>

Returns:

a Set of the values found
findAll
(Set<T>
a Set
self
)

Finds the items matching the IDENTITY Closure (i.e. matching Groovy truth).

public static <T> List<T>

Returns:

a List of the values found
findAll
(List<T>
a List
self
)

Finds the items matching the IDENTITY Closure (i.e. matching Groovy truth).

public static <T> Collection<T>

Returns:

a Collection of the values found
findAll
(Collection<T>
a Collection
self
)

Finds the items matching the IDENTITY Closure (i.e. matching Groovy truth).

public static <T> Collection<T>

Returns:

a collection of the elements found
findAll
(T[]
an array
self
)

Finds the elements of the array matching the IDENTITY Closure (i.e. matching Groovy truth).

public static Collection<E>

Returns:

a List of the values found
findAll
(Object
an Object with an Iterator returning its values
self
,
Closure<V>
a closure condition
closure
)

Finds all items matching the closure condition.

public static Collection<E>

Returns:

a List of the values found
findAll
(Object
an Object with an Iterator returning its values
self
)

Finds all items matching the IDENTITY Closure (i.e. matching Groovy truth).

private static <T> Collection<T>
findAll(Closure<V> closure, Collection<T> answer, Iterator<? extends T> iter)

public static <K, V> Map<K, V>

Returns:

a new subMap
findAll
(Map<K, V>
a Map
self
,
Closure<V>
a 1 or 2 arg Closure condition applying on the entries
closure
)

Finds all entries matching the closure condition.

public static int

Returns:

an integer that is the index of the first matched object or -1 if no match was found
findIndexOf
(Object
the iteration object over which to iterate
self
,
Closure<V>
the matching condition
condition
)

Iterates over the elements of an aggregate of items and returns the index of the first item that matches the condition specified in the closure.

public static int

Returns:

an integer that is the index of the first matched object or -1 if no match was found
findIndexOf
(Object
the iteration object over which to iterate
self
,
int
start matching from this index
startIndex
,
Closure<V>
the matching condition
condition
)

Iterates over the elements of an aggregate of items, starting from a specified startIndex, and returns the index of the first item that matches the condition specified in the closure.

public static <T> int

Returns:

an integer that is the index of the first matched object or -1 if no match was found
findIndexOf
(Iterator<T>
an Iterator
self
,
Closure<V>
the matching condition
condition
)

Iterates over the elements of an Iterator and returns the index of the first item that satisfies the condition specified by the closure.

public static <T> int

Returns:

an integer that is the index of the first matched object or -1 if no match was found
findIndexOf
(Iterator<T>
an Iterator
self
,
int
start matching from this index
startIndex
,
Closure<V>
the matching condition
condition
)

Iterates over the elements of an Iterator, starting from a specified startIndex, and returns the index of the first item that satisfies the condition specified by the closure.

public static <T> int

Returns:

an integer that is the index of the first matched object or -1 if no match was found
findIndexOf
(Iterable<T>
an Iterable
self
,
Closure<V>
the matching condition
condition
)

Iterates over the elements of an Iterable and returns the index of the first item that satisfies the condition specified by the closure.

public static <T> int

Returns:

an integer that is the index of the first matched object or -1 if no match was found
findIndexOf
(Iterable<T>
an Iterable
self
,
int
start matching from this index
startIndex
,
Closure<V>
the matching condition
condition
)

Iterates over the elements of an Iterable, starting from a specified startIndex, and returns the index of the first item that satisfies the condition specified by the closure.

public static <T> int

Returns:

an integer that is the index of the first matched object or -1 if no match was found
findIndexOf
(T[]
an Array
self
,
Closure<V>
the matching condition
condition
)

Iterates over the elements of an Array and returns the index of the first item that satisfies the condition specified by the closure.

public static <T> int

Returns:

an integer that is the index of the first matched object or -1 if no match was found
findIndexOf
(T[]
an Array
self
,
int
start matching from this index
startIndex
,
Closure<V>
the matching condition
condition
)

Iterates over the elements of an Array, starting from a specified startIndex, and returns the index of the first item that satisfies the condition specified by the closure.

public static List<Number>

Returns:

a list of numbers corresponding to the index values of all matched objects
findIndexValues
(Object
the iteration object over which to iterate
self
,
Closure<V>
the matching condition
condition
)

Iterates over the elements of an aggregate of items and returns the index values of the items that match the condition specified in the closure.

public static List<Number>

Returns:

a list of numbers corresponding to the index values of all matched objects
findIndexValues
(Object
the iteration object over which to iterate
self
,
Number
start matching from this index
startIndex
,
Closure<V>
the matching condition
condition
)

Iterates over the elements of an aggregate of items, starting from a specified startIndex, and returns the index values of the items that match the condition specified in the closure.

public static <T> List<Number>

Returns:

a list of numbers corresponding to the index values of all matched objects
findIndexValues
(Iterator<T>
an Iterator
self
,
Closure<V>
the matching condition
condition
)

Iterates over the elements of an Iterator and returns the index values of the items that match the condition specified in the closure.

public static <T> List<Number>

Returns:

a list of numbers corresponding to the index values of all matched objects
findIndexValues
(Iterator<T>
an Iterator
self
,
Number
start matching from this index
startIndex
,
Closure<V>
the matching condition
condition
)

Iterates over the elements of an Iterator, starting from a specified startIndex, and returns the index values of the items that match the condition specified in the closure.

public static <T> List<Number>

Returns:

a list of numbers corresponding to the index values of all matched objects
findIndexValues
(Iterable<T>
an Iterable
self
,
Closure<V>
the matching condition
condition
)

Iterates over the elements of an Iterable and returns the index values of the items that match the condition specified in the closure.

public static <T> List<Number>

Returns:

a list of numbers corresponding to the index values of all matched objects
findIndexValues
(Iterable<T>
an Iterable
self
,
Number
start matching from this index
startIndex
,
Closure<V>
the matching condition
condition
)

Iterates over the elements of an Iterable, starting from a specified startIndex, and returns the index values of the items that match the condition specified in the closure.

public static <T> List<Number>

Returns:

a list of numbers corresponding to the index values of all matched objects
findIndexValues
(T[]
an Array
self
,
Closure<V>
the matching condition
condition
)

Iterates over the elements of an Array and returns the index values of the items that match the condition specified in the closure.

public static <T> List<Number>

Returns:

a list of numbers corresponding to the index values of all matched objects
findIndexValues
(T[]
an Array
self
,
Number
start matching from this index
startIndex
,
Closure<V>
the matching condition
condition
)

Iterates over the elements of an Array, starting from a specified startIndex, and returns the index values of the items that match the condition specified in the closure.

public static int

Returns:

an integer that is the index of the last matched object or -1 if no match was found
findLastIndexOf
(Object
the iteration object over which to iterate
self
,
Closure<V>
the matching condition
condition
)

Iterates over the elements of an aggregate of items and returns the index of the last item that matches the condition specified in the closure.

public static int

Returns:

an integer that is the index of the last matched object or -1 if no match was found
findLastIndexOf
(Object
the iteration object over which to iterate
self
,
int
start matching from this index
startIndex
,
Closure<V>
the matching condition
condition
)

Iterates over the elements of an aggregate of items, starting from a specified startIndex, and returns the index of the last item that matches the condition specified in the closure.

public static <T> int

Returns:

an integer that is the index of the last matched object or -1 if no match was found
findLastIndexOf
(Iterator<T>
an Iterator
self
,
Closure<V>
the matching condition
condition
)

Iterates over the elements of an Iterator and returns the index of the last item that matches the condition specified in the closure.

public static <T> int

Returns:

an integer that is the index of the last matched object or -1 if no match was found
findLastIndexOf
(Iterator<T>
an Iterator
self
,
int
start matching from this index
startIndex
,
Closure<V>
the matching condition
condition
)

Iterates over the elements of an Iterator, starting from a specified startIndex, and returns the index of the last item that matches the condition specified in the closure.

public static <T> int

Returns:

an integer that is the index of the last matched object or -1 if no match was found
findLastIndexOf
(Iterable<T>
an Iterable
self
,
Closure<V>
the matching condition
condition
)

Iterates over the elements of an Iterable and returns the index of the last item that matches the condition specified in the closure.

public static <T> int

Returns:

an integer that is the index of the last matched object or -1 if no match was found
findLastIndexOf
(Iterable<T>
an Iterable
self
,
int
start matching from this index
startIndex
,
Closure<V>
the matching condition
condition
)

Iterates over the elements of an Iterable, starting from a specified startIndex, and returns the index of the last item that matches the condition specified in the closure.

public static <T> int

Returns:

an integer that is the index of the last matched object or -1 if no match was found
findLastIndexOf
(T[]
an Array
self
,
Closure<V>
the matching condition
condition
)

Iterates over the elements of an Array and returns the index of the last item that matches the condition specified in the closure.

public static <T> int

Returns:

an integer that is the index of the last matched object or -1 if no match was found
findLastIndexOf
(T[]
an Array
self
,
int
start matching from this index
startIndex
,
Closure<V>
the matching condition
condition
)

Iterates over the elements of an Array, starting from a specified startIndex, and returns the index of the last item that matches the condition specified in the closure.

public static Object

Returns:

the first non-null result of the closure
findResult
(Object
an Object with an iterator returning its values
self
,
Closure<V>
a closure that returns a non-null value to indicate that processing should stop and the value should be returned
condition
)

Treats the object as iterable, iterating through the values it represents and returns the first non-null result obtained from calling the closure, otherwise returns null.

public static Object

Returns:

the first non-null result of the closure, otherwise the default value
findResult
(Object
an Object with an iterator returning its values
self
,
Object
an Object that should be returned if all closure results are null
defaultResult
,
Closure<V>
a closure that returns a non-null value to indicate that processing should stop and the value should be returned
condition
)

Treats the object as iterable, iterating through the values it represents and returns the first non-null result obtained from calling the closure, otherwise returns the defaultResult.

public static <S, T, U extends T, V extends T> T

Returns:

the first non-null result from calling the closure, or the defaultValue
findResult
(Collection<S>
a Collection
self
,
U
an Object that should be returned if all closure results are null
defaultResult
,
Closure<V>
a closure that returns a non-null value to indicate that processing should stop and the value should be returned
condition
)

Deprecated use the Iterable version instead
Iterates through the collection calling the given closure for each item but stopping once the first non-null result is found and returning that result.
public static <S, T> T

Returns:

the first non-null result from calling the closure, or null
findResult
(Collection<S>
a Collection
self
,
Closure<T>
a closure that returns a non-null value to indicate that processing should stop and the value should be returned
condition
)

Deprecated use the Iterable version instead
Iterates through the collection calling the given closure for each item but stopping once the first non-null result is found and returning that result.
public static <S, T, U extends T, V extends T> T

Returns:

the first non-null result from calling the closure, or the defaultValue
findResult
(Iterator<S>
an Iterator
self
,
U
an Object that should be returned if all closure results are null
defaultResult
,
Closure<V>
a closure that returns a non-null value to indicate that processing should stop and the value should be returned
condition
)

Iterates through the Iterator calling the given closure condition for each item but stopping once the first non-null result is found and returning that result.

public static <T, U> T

Returns:

the first non-null result from calling the closure, or null
findResult
(Iterator<U>
an Iterator
self
,
Closure<T>
a closure that returns a non-null value to indicate that processing should stop and the value should be returned
condition
)

Iterates through the Iterator calling the given closure condition for each item but stopping once the first non-null result is found and returning that result.

public static <S, T, U extends T, V extends T> T

Returns:

the first non-null result from calling the closure, or the defaultValue
findResult
(Iterable<S>
an Iterable
self
,
U
an Object that should be returned if all closure results are null
defaultResult
,
Closure<V>
a closure that returns a non-null value to indicate that processing should stop and the value should be returned
condition
)

Iterates through the Iterable calling the given closure condition for each item but stopping once the first non-null result is found and returning that result.

public static <T, U> T

Returns:

the first non-null result from calling the closure, or null
findResult
(Iterable<U>
an Iterable
self
,
Closure<T>
a closure that returns a non-null value to indicate that processing should stop and the value should be returned
condition
)

Iterates through the Iterable calling the given closure condition for each item but stopping once the first non-null result is found and returning that result.

public static <S, T, U extends T, V extends T> T

Returns:

the first non-null result from calling the closure, or the defaultValue
findResult
(S[]
an Array
self
,
U
an Object that should be returned if all closure results are null
defaultResult
,
Closure<V>
a closure that returns a non-null value to indicate that processing should stop and the value should be returned
condition
)

Iterates through the Array calling the given closure condition for each item but stopping once the first non-null result is found and returning that result.

public static <S, T> T

Returns:

the first non-null result from calling the closure, or null
findResult
(S[]
an Array
self
,
Closure<T>
a closure that returns a non-null value to indicate that processing should stop and the value should be returned
condition
)

Iterates through the Array calling the given closure condition for each item but stopping once the first non-null result is found and returning that result.

public static <T, K, V> T

Returns:

the first non-null result collected by calling the closure, or null if no such result was found
findResult
(Map<K, V>
a Map
self
,
Closure<T>
a 1 or 2 arg Closure that returns a non-null value when processing should stop and a value should be returned
condition
)

Returns the first non-null closure result found by passing each map entry to the closure, otherwise null is returned.

public static <T, U extends T, V extends T, A, B> T

Returns:

the first non-null result collected by calling the closure, or the defaultResult if no such result was found
findResult
(Map<A, B>
a Map
self
,
U
an Object that should be returned if all closure results are null
defaultResult
,
Closure<V>
a 1 or 2 arg Closure that returns a non-null value when processing should stop and a value should be returned
condition
)

Returns the first non-null closure result found by passing each map entry to the closure, otherwise the defaultResult is returned.

public static <T, U> Collection<T>
findResults(Collection<U> self, Closure<T> filteringTransform)

Deprecated Use the Iterable version of findResults instead
public static <T, U> Collection<T>

Returns:

the list of non-null transformed values
findResults
(Iterable<U>
an Iterable
self
,
Closure<T>
a Closure that should return either a non-null transformed value or null for items which should be discarded
filteringTransform
)

Iterates through the Iterable transforming items using the supplied closure and collecting any non-null results.

public static <T, U> Collection<T>

Returns:

the list of non-null transformed values
findResults
(Iterator<U>
an Iterator
self
,
Closure<T>
a Closure that should return either a non-null transformed value or null for items which should be discarded
filteringTransform
)

Iterates through the Iterator transforming items using the supplied closure and collecting any non-null results.

public static <T, U> Collection<T>

Returns:

the list of non-null transformed values
findResults
(U[]
an Array
self
,
Closure<T>
a Closure that should return either a non-null transformed value or null for items which should be discarded
filteringTransform
)

Iterates through the Array transforming items using the supplied closure and collecting any non-null results.

public static <T, K, V> Collection<T>

Returns:

the list of non-null transformed values
findResults
(Map<K, V>
a Map
self
,
Closure<T>
a 1 or 2 arg Closure that should return either a non-null transformed value or null for items which should be discarded
filteringTransform
)

Iterates through the map transforming items using the supplied closure and collecting any non-null results.

public static <T> T

Returns:

the first item from the List
first
(List<T>
a List
self
)

Returns the first item from the List.

public static <T> T

Returns:

the first item from the Iterable
first
(Iterable<T>
an Iterable
self
)

Returns the first item from the Iterable.

public static <T> T

Returns:

the first item from the array
first
(T[]
an array
self
)

Returns the first item from the array.

public static Collection<?>

Returns:

a flattened Collection
flatten
(Collection<?>
a Collection to flatten
self
)

Flatten a Collection.

public static Collection<?>

Returns:

a flattened Collection
flatten
(Iterable<?>
an Iterable to flatten
self
)

Flatten an Iterable.

public static List<?>

Returns:

a flattened List
flatten
(List<?>
a List to flatten
self
)

Flatten a List.

public static Set<?>

Returns:

a flattened Set
flatten
(Set<?>
a Set to flatten
self
)

Flatten a Set.

public static SortedSet<?>

Returns:

a flattened SortedSet
flatten
(SortedSet<?>
a SortedSet to flatten
self
)

Flatten a SortedSet.

public static Collection<E>

Returns:

a flattened Collection
flatten
(Object[]
an Array to flatten
self
)

Flatten an array.

public static Collection<E>

Returns:

a flattened Collection
flatten
(boolean[]
a boolean Array to flatten
self
)

Flatten an array.

public static Collection<E>

Returns:

a flattened Collection
flatten
(byte[]
a byte Array to flatten
self
)

Flatten an array.

public static Collection<E>

Returns:

a flattened Collection
flatten
(char[]
a char Array to flatten
self
)

Flatten an array.

public static Collection<E>

Returns:

a flattened Collection
flatten
(short[]
a short Array to flatten
self
)

Flatten an array.

public static Collection<E>

Returns:

a flattened Collection
flatten
(int[]
an int Array to flatten
self
)

Flatten an array.

public static Collection<E>

Returns:

a flattened Collection
flatten
(long[]
a long Array to flatten
self
)

Flatten an array.

public static Collection<E>

Returns:

a flattened Collection
flatten
(float[]
a float Array to flatten
self
)

Flatten an array.

public static Collection<E>

Returns:

a flattened Collection
flatten
(double[]
a double Array to flatten
self
)

Flatten an array.

private static Collection<E>
flatten(Iterable<T> elements, Collection<E> addTo)

public static <T> Collection<T>
flatten(Collection<T> self, Closure<? extends T> flattenUsing)

Deprecated Use the Iterable version of flatten instead
public static <T> Collection<T>

Returns:

a flattened Collection
flatten
(Iterable<T>
an Iterable
self
,
Closure<? extends T>
a closure to determine how to flatten non-Array, non-Collection elements
flattenUsing
)

Flatten an Iterable.

private static <T> Collection<T>
flatten(Iterable<T> elements, Collection<T> addTo, Closure<? extends T> flattenUsing)

public static <K, V> V

Returns:

the value of the given key or the default value, added to the map if the key did not exist
get
(Map<K, V>
a Map
map
,
K
the key to lookup the value of
key
,
V
the value to return and add to the map for this key if there is no entry for the given key
defaultValue
)

Looks up an item in a Map for the given key and returns the value - unless there is no entry for the given key in which case add the default value to the map and return that.

public static Object

Returns:

the property value
getAt
(Object
the object to act upon
self
,
String
the property name of interest
property
)

Allows the subscript operator to be used to lookup dynamic property values.

public static <T> List<T>

Returns:

a new list instance based on range borders
getAt
(List<T>
a List
self
,
Range<T extends Comparable<T>>
a Range indicating the items to get
range
)

Support the range subscript operator for a List.

public static <T> List<T>

Returns:

a new eager or lazy list of the values at the given indices
getAt
(ListWithDefault<T>
a ListWithDefault
self
,
Collection<E>
a Collection of indices
indices
)

Select a List of items from an eager or lazy List using a Collection to identify the indices to be selected.

public static <T> List<T>

Returns:

a new eager or lazy list instance based on range borders
getAt
(ListWithDefault<T>
a ListWithDefault
self
,
Range<T extends Comparable<T>>
a Range indicating the items to get
range
)

Support the range subscript operator for an eager or lazy List.

public static <T> List<T>

Returns:

a new list instance based on range borders
getAt
(ListWithDefault<T>
a ListWithDefault
self
,
EmptyRange<T extends Comparable<T>>
a Range indicating the items to get
range
)

Support the range subscript operator for an eager or lazy List.

public static <T> List<T>

Returns:

a new list instance based on range borders
getAt
(List<T>
a List
self
,
EmptyRange<T extends Comparable<T>>
a Range indicating the items to get
range
)

Support the range subscript operator for a List.

public static <T> List<T>

Returns:

a new list of the values at the given indices
getAt
(List<T>
a List
self
,
Collection<E>
a Collection of indices
indices
)

Select a List of items from a List using a Collection to identify the indices to be selected.

public static <T> List<T>

Returns:

a new list of the values at the given indices
getAt
(T[]
an array
self
,
Collection<E>
a Collection of indices
indices
)

Select a List of items from an array using a Collection to identify the indices to be selected.

public static <T> List<T>

Returns:

a range of a list from the range's from index up to but not including the range's to value
getAt
(T[]
an Array of Objects
array
,
Range<T extends Comparable<T>>
a Range
range
)

Support the range subscript operator for an Array

public static <T> List<T>

Returns:

a range of a list from the range's from index up to but not including the range's to value
getAt
(T[]
an Array of Objects
array
,
IntRange
an IntRange
range
)

public static <T> List<T>

Returns:

an empty Range
getAt
(T[]
an Array of Objects
array
,
EmptyRange<T extends Comparable<T>>
an EmptyRange
range
)

public static <T> List<T>

Returns:

a range of a list from the range's from index up to but not including the range's to value
getAt
(T[]
an Array of Objects
array
,
ObjectRange
an ObjectRange
range
)

public static <T> T

Returns:

the value at the given index
getAt
(List<T>
a List
self
,
int
an index
idx
)

Support the subscript operator for a List.

public static <T> T
getAt(List<T> self, Number idx)

Support subscript operator for list access.

public static <T> T

Returns:

the value at the given index (after normalisation) or null if no corresponding value was found
getAt
(Iterator<T>
an Iterator
self
,
int
an index value (-self.size() <= idx < self.size())
idx
)

Support the subscript operator for an Iterator.

public static <T> T

Returns:

the value at the given index (after normalisation) or null if no corresponding value was found
getAt
(Iterable<T>
an Iterable
self
,
int
an index value (-self.size() <= idx < self.size()) but using -ve index values will be inefficient
idx
)

Support the subscript operator for an Iterable.

public static <K, V> V

Returns:

the value corresponding to the given key
getAt
(Map<K, V>
a Map
self
,
Object
an Object as a key for the map
key
)

Support the subscript operator for a Map.

public static List<E>

Returns:

a List
getAt
(Collection<E>
a Collection
coll
,
String
a String
property
)

Support the subscript operator for Collection.

public static List<Byte>

Returns:

list of the retrieved bytes
getAt
(byte[]
a byte array
array
,
Range<T extends Comparable<T>>
a range indicating the indices for the items to retrieve
range
)

Support the subscript operator with a range for a byte array

public static List<Character>

Returns:

list of the retrieved chars
getAt
(char[]
a char array
array
,
Range<T extends Comparable<T>>
a range indicating the indices for the items to retrieve
range
)

Support the subscript operator with a range for a char array

public static List<Short>

Returns:

list of the retrieved shorts
getAt
(short[]
a short array
array
,
Range<T extends Comparable<T>>
a range indicating the indices for the items to retrieve
range
)

Support the subscript operator with a range for a short array

public static List<Integer>

Returns:

list of the ints at the given indices
getAt
(int[]
an int array
array
,
Range<T extends Comparable<T>>
a range indicating the indices for the items to retrieve
range
)

Support the subscript operator with a range for an int array

public static List<Long>

Returns:

list of the retrieved longs
getAt
(long[]
a long array
array
,
Range<T extends Comparable<T>>
a range indicating the indices for the items to retrieve
range
)

Support the subscript operator with a range for a long array

public static List<Float>

Returns:

list of the retrieved floats
getAt
(float[]
a float array
array
,
Range<T extends Comparable<T>>
a range indicating the indices for the items to retrieve
range
)

Support the subscript operator with a range for a float array

public static List<Double>

Returns:

list of the retrieved doubles
getAt
(double[]
a double array
array
,
Range<T extends Comparable<T>>
a range indicating the indices for the items to retrieve
range
)

Support the subscript operator with a range for a double array

public static List<Boolean>

Returns:

list of the retrieved booleans
getAt
(boolean[]
a boolean array
array
,
Range<T extends Comparable<T>>
a range indicating the indices for the items to retrieve
range
)

Support the subscript operator with a range for a boolean array

public static List<Byte>

Returns:

list of the retrieved bytes
getAt
(byte[]
a byte array
array
,
IntRange
an IntRange indicating the indices for the items to retrieve
range
)

Support the subscript operator with an IntRange for a byte array

public static List<Character>

Returns:

list of the retrieved chars
getAt
(char[]
a char array
array
,
IntRange
an IntRange indicating the indices for the items to retrieve
range
)

Support the subscript operator with an IntRange for a char array

public static List<Short>

Returns:

list of the retrieved shorts
getAt
(short[]
a short array
array
,
IntRange
an IntRange indicating the indices for the items to retrieve
range
)

Support the subscript operator with an IntRange for a short array

public static List<Integer>

Returns:

list of the retrieved ints
getAt
(int[]
an int array
array
,
IntRange
an IntRange indicating the indices for the items to retrieve
range
)

Support the subscript operator with an IntRange for an int array

public static List<Long>

Returns:

list of the retrieved longs
getAt
(long[]
a long array
array
,
IntRange
an IntRange indicating the indices for the items to retrieve
range
)

Support the subscript operator with an IntRange for a long array

public static List<Float>

Returns:

list of the retrieved floats
getAt
(float[]
a float array
array
,
IntRange
an IntRange indicating the indices for the items to retrieve
range
)

Support the subscript operator with an IntRange for a float array

public static List<Double>

Returns:

list of the retrieved doubles
getAt
(double[]
a double array
array
,
IntRange
an IntRange indicating the indices for the items to retrieve
range
)

Support the subscript operator with an IntRange for a double array

public static List<Boolean>

Returns:

list of the retrieved booleans
getAt
(boolean[]
a boolean array
array
,
IntRange
an IntRange indicating the indices for the items to retrieve
range
)

Support the subscript operator with an IntRange for a boolean array

public static List<Byte>

Returns:

list of the retrieved bytes
getAt
(byte[]
a byte array
array
,
ObjectRange
an ObjectRange indicating the indices for the items to retrieve
range
)

Support the subscript operator with an ObjectRange for a byte array

public static List<Character>

Returns:

list of the retrieved chars
getAt
(char[]
a char array
array
,
ObjectRange
an ObjectRange indicating the indices for the items to retrieve
range
)

Support the subscript operator with an ObjectRange for a char array

public static List<Short>

Returns:

list of the retrieved shorts
getAt
(short[]
a short array
array
,
ObjectRange
an ObjectRange indicating the indices for the items to retrieve
range
)

Support the subscript operator with an ObjectRange for a short array

public static List<Integer>

Returns:

list of the retrieved ints
getAt
(int[]
an int array
array
,
ObjectRange
an ObjectRange indicating the indices for the items to retrieve
range
)

Support the subscript operator with an ObjectRange for an int array

public static List<Long>

Returns:

list of the retrieved longs
getAt
(long[]
a long array
array
,
ObjectRange
an ObjectRange indicating the indices for the items to retrieve
range
)

Support the subscript operator with an ObjectRange for a long array

public static List<Float>

Returns:

list of the retrieved floats
getAt
(float[]
a float array
array
,
ObjectRange
an ObjectRange indicating the indices for the items to retrieve
range
)

Support the subscript operator with an ObjectRange for a float array

public static List<Double>

Returns:

list of the retrieved doubles
getAt
(double[]
a double array
array
,
ObjectRange
an ObjectRange indicating the indices for the items to retrieve
range
)

Support the subscript operator with an ObjectRange for a double array

public static List<Boolean>

Returns:

list of the retrieved bytes
getAt
(boolean[]
a byte array
array
,
ObjectRange
an ObjectRange indicating the indices for the items to retrieve
range
)

Support the subscript operator with an ObjectRange for a byte array

public static List<Byte>

Returns:

list of the bytes at the given indices
getAt
(byte[]
a byte array
array
,
Collection<E>
a collection of indices for the items to retrieve
indices
)

Support the subscript operator with a collection for a byte array

public static List<Character>

Returns:

list of the chars at the given indices
getAt
(char[]
a char array
array
,
Collection<E>
a collection of indices for the items to retrieve
indices
)

Support the subscript operator with a collection for a char array

public static List<Short>

Returns:

list of the shorts at the given indices
getAt
(short[]
a short array
array
,
Collection<E>
a collection of indices for the items to retrieve
indices
)

Support the subscript operator with a collection for a short array

public static List<Integer>

Returns:

list of the ints at the given indices
getAt
(int[]
an int array
array
,
Collection<E>
a collection of indices for the items to retrieve
indices
)

Support the subscript operator with a collection for an int array

public static List<Long>

Returns:

list of the longs at the given indices
getAt
(long[]
a long array
array
,
Collection<E>
a collection of indices for the items to retrieve
indices
)

Support the subscript operator with a collection for a long array

public static List<Float>

Returns:

list of the floats at the given indices
getAt
(float[]
a float array
array
,
Collection<E>
a collection of indices for the items to retrieve
indices
)

Support the subscript operator with a collection for a float array

public static List<Double>

Returns:

list of the doubles at the given indices
getAt
(double[]
a double array
array
,
Collection<E>
a collection of indices for the items to retrieve
indices
)

Support the subscript operator with a collection for a double array

public static List<Boolean>

Returns:

list of the booleans at the given indices
getAt
(boolean[]
a boolean array
array
,
Collection<E>
a collection of indices for the items to retrieve
indices
)

Support the subscript operator with a collection for a boolean array

public static boolean

Returns:

value of the bit at the given index
getAt
(BitSet
a BitSet
self
,
int
index to retrieve
index
)

Support the subscript operator for a Bitset

public static BitSet

Returns:

a new BitSet that represents the requested subset
getAt
(BitSet
a BitSet
self
,
IntRange
a Range defining the desired subset
range
)

Support retrieving a subset of a BitSet using a Range

private static <T> T
getAtImpl(T[] array, int idx)

private static List<E>
getAtIterable(Iterable<T> coll, String property, List<Object> answer)

private static Object
public static Groovydoc

Returns:

runtime groovydoc
getGroovydoc
(AnnotatedElement
the groovydoc hold
holder
)

Get runtime groovydoc

public static IntRange

Returns:

an index range
getIndices
(Collection<E>
a collection
self
)

Returns indices of the collection.

public static <T> IntRange

Returns:

an index range
getIndices
(T[]
an array
self
)

Returns indices of the array.

public static IntRange
getIndices(boolean[] self)

Returns indices of the boolean array.

public static IntRange
getIndices(byte[] self)

Returns indices of the byte array.

public static IntRange
getIndices(char[] self)

Returns indices of the char array.

public static IntRange
getIndices(double[] self)

Returns indices of the double array.

public static IntRange
getIndices(float[] self)

Returns indices of the float array.

public static IntRange
getIndices(int[] self)

Returns indices of the int array.

public static IntRange
getIndices(long[] self)

Returns indices of the long array.

public static IntRange
getIndices(short[] self)

Returns indices of the short array.

public static URL

Returns:

the url of the jar, null if the specified class is from JDK
getLocation
(Class<T>
the class
self
)

Gets the url of the jar file/source file containing the specified class

public static MetaClass

Returns:

An MetaClass instance
getMetaClass
(Class<T>
The java.lang.Class instance
c
)

Adds a "metaClass" property to all class objects so you can use the syntax String.metaClass.myMethod = { println "foo" }

public static MetaClass

Returns:

The MetaClass
getMetaClass
(Object
The object in question
obj
)

Obtains a MetaClass for an object either from the registry or in the case of a GroovyObject from the object itself.

public static MetaClass

Returns:

The MetaClass
getMetaClass
(GroovyObject
The object in question
obj
)

Obtains a MetaClass for an object either from the registry or in the case of a GroovyObject from the object itself.

public static List<PropertyValue>

Returns:

list of groovy.lang.PropertyValue objects
getMetaPropertyValues
(Object
the receiver object
self
)

Retrieves the list of groovy.lang.MetaProperty objects for 'self' and wraps it in a list of groovy.lang.PropertyValue objects that additionally provide the value for each property of 'self'.

public static Map<K, V>

Returns:

meta properties as Map of key/value pairs
getProperties
(Object
the receiver object
self
)

Convenience method that calls getMetaPropertyValues(java.lang.Object)(self) and provides the data in form of simple key/value pairs, i.e. without type() information.

public static ClassLoader

Returns:

the rootLoader for the ClassLoader
getRootLoader
(ClassLoader
a ClassLoader
self
)

Iterates through the classloader parents until it finds a loader with a class named "org.codehaus.groovy.tools.RootLoader".

protected static List<E>
getSubList(List<E> self, List<E> splice)

Deprecated
public static Collection<E>

Returns:

a collection of objects which match the filter
grep
(Object
the object over which we iterate
self
,
Object
the filter to perform on the object (using the isCase(java.lang.Object, java.lang.Object) method)
filter
)

Iterates over the collection of items which this Object represents and returns each item that matches the given filter - calling the isCase(java.lang.Object, java.lang.Object) method used by switch statements.

public static <T> Collection<T>

Returns:

a collection of objects which match the filter
grep
(Collection<T>
a collection
self
,
Object
the filter to perform on each element of the collection (using the isCase(java.lang.Object, java.lang.Object) method)
filter
)

Iterates over the collection of items and returns each item that matches the given filter - calling the isCase(java.lang.Object, java.lang.Object) method used by switch statements.

public static <T> List<T>

Returns:

a List of objects which match the filter
grep
(List<T>
a List
self
,
Object
the filter to perform on each element of the collection (using the isCase(java.lang.Object, java.lang.Object) method)
filter
)

Iterates over the collection of items and returns each item that matches the given filter - calling the isCase(java.lang.Object, java.lang.Object) method used by switch statements.

public static <T> Set<T>

Returns:

a Set of objects which match the filter
grep
(Set<T>
a Set
self
,
Object
the filter to perform on each element of the collection (using the isCase(java.lang.Object, java.lang.Object) method)
filter
)

Iterates over the collection of items and returns each item that matches the given filter - calling the isCase(java.lang.Object, java.lang.Object) method used by switch statements.

public static <T> Collection<T>

Returns:

a collection of objects which match the filter
grep
(T[]
an array
self
,
Object
the filter to perform on each element of the array (using the isCase(java.lang.Object, java.lang.Object) method)
filter
)

Iterates over the array of items and returns a collection of items that match the given filter - calling the isCase(java.lang.Object, java.lang.Object) method used by switch statements.

public static Collection<E>

Returns:

a collection of objects which match the filter
grep
(Object
the object over which we iterate
self
)

Iterates over the collection of items which this Object represents and returns each item that matches using the IDENTITY Closure as a filter - effectively returning all elements which satisfy Groovy truth.

public static <T> Collection<T>

Returns:

a collection of elements satisfy Groovy truth
grep
(Collection<T>
a Collection
self
)

Iterates over the collection returning each element that matches using the IDENTITY Closure as a filter - effectively returning all elements which satisfy Groovy truth.

public static <T> List<T>

Returns:

a List of elements satisfy Groovy truth
grep
(List<T>
a List
self
)

Iterates over the collection returning each element that matches using the IDENTITY Closure as a filter - effectively returning all elements which satisfy Groovy truth.

public static <T> Set<T>

Returns:

a Set of elements satisfy Groovy truth
grep
(Set<T>
a Set
self
)

Iterates over the collection returning each element that matches using the IDENTITY Closure as a filter - effectively returning all elements which satisfy Groovy truth.

public static <T> Collection<T>

Returns:

a collection of elements which satisfy Groovy truth
grep
(T[]
an array
self
)

Iterates over the array returning each element that matches using the IDENTITY Closure as a filter - effectively returning all elements which satisfy Groovy truth.

protected static <K, T> void
groupAnswer(final Map<K, List<T>>
the map containing the results
answer
,
T
the element to be placed
element
,
K
the value according to which the element will be placed
value
)

Groups the current element according to the value

public static <K, T> Map<K, List<T>>
groupBy(Collection<T> self, Closure<K> closure)

Deprecated Use the Iterable version of groupBy instead
public static <K, T> Map<K, List<T>>

Returns:

a new Map grouped by keys
groupBy
(Iterable<T>
a collection to group
self
,
Closure<K>
a closure mapping entries on keys
closure
)

Sorts all Iterable members into groups determined by the supplied mapping closure.

public static <K, T> Map<K, List<T>>

Returns:

a new Map grouped by keys
groupBy
(T[]
an array to group
self
,
Closure<K>
a closure mapping entries on keys
closure
)

Sorts all array members into groups determined by the supplied mapping closure.

public static Map<K, V>
groupBy(Collection<E> self, Object... closures)

Deprecated Use the Iterable version of groupBy instead
public static Map<K, V>

Returns:

a new Map grouped by keys on each criterion
groupBy
(Iterable<T>
a collection to group
self
,
Object...
an array of closures, each mapping entries on keys
closures
)

Sorts all Iterable members into (sub)groups determined by the supplied mapping closures.

public static Map<K, V>

Returns:

a new Map grouped by keys on each criterion
groupBy
(Object[]
an array to group
self
,
Object...
an array of closures, each mapping entries on keys
closures
)

Sorts all array members into (sub)groups determined by the supplied mapping closures as per the Iterable variant of this method.

public static Map<K, V>
groupBy(Collection<E> self, List<Closure<V>> closures)

Deprecated Use the Iterable version of groupBy instead
public static Map<K, V>

Returns:

a new Map grouped by keys on each criterion
groupBy
(Iterable<T>
a collection to group
self
,
List<Closure<V>>
a list of closures, each mapping entries on keys
closures
)

Sorts all Iterable members into (sub)groups determined by the supplied mapping closures.

public static Map<K, V>

Returns:

a new Map grouped by keys on each criterion
groupBy
(Object[]
an array to group
self
,
List<Closure<V>>
a list of closures, each mapping entries on keys
closures
)

Sorts all array members into (sub)groups determined by the supplied mapping closures as per the list variant of this method.

public static <G, K, V> Map<G, Map<K, V>>

Returns:

a new Map grouped by keys
groupBy
(Map<K, V>
a map to group
self
,
Closure<G>
a closure mapping entries on keys
closure
)

Groups the members of a map into sub maps determined by the supplied mapping closure.

public static Map<Object, Map<K, V>>

Returns:

a new map grouped by keys on each criterion
groupBy
(Map<K, V>
a map to group
self
,
Object...
an array of closures that map entries on keys
closures
)

Groups the members of a map into sub maps determined by the supplied mapping closures.

public static Map<Object, Map<K, V>>

Returns:

a new map grouped by keys on each criterion
groupBy
(Map<K, V>
a map to group
self
,
List<Closure<V>>
a list of closures that map entries on keys
closures
)

Groups the members of a map into sub maps determined by the supplied mapping closures.

public static <G, K, V> Map<G, List<Map.Entry<K, V>>>

Returns:

a new Map grouped by keys
groupEntriesBy
(Map<K, V>
a map to group
self
,
Closure<G>
a 1 or 2 arg Closure mapping entries on keys
closure
)

Groups all map entries into groups determined by the supplied mapping closure.

private static MetaClass
public static MetaProperty

Returns:

The found MetaProperty or null if it doesn't exist
hasProperty
(Object
The object to inspect
self
,
String
The name of the property of interest
name
)

Returns true of the implementing MetaClass has a property of the given name

Note that this method will only return true for realised properties and does not take into account implementation of getProperty or propertyMissing

public static <T> T

Returns:

the first item from the Iterable
head
(Iterable<T>
an Iterable
self
)

Returns the first item from the Iterable.

public static <T> T

Returns:

the first item from the List
head
(List<T>
a List
self
)

Returns the first item from the List.

public static <T> T

Returns:

the first item from the Object array
head
(T[]
an array
self
)

Returns the first item from the Object array.

public static <T, U> T

Returns:

result of calling the closure
identity
(U
the object to have a closure act upon
self
,
Closure<T>
the closure to call on the object
closure
)

Allows the closure to be called for the object reference self.

public static Boolean

Returns:

result of logical implication
implies
(Boolean
left operator
left
,
Boolean
right operator
right
)

Logical implication of two boolean operators

public static <E> Map<Integer, E>

Returns:

a zipped map with indices
indexed
(Iterable<E>
an Iterable
self
)

Zips an Iterable with indices in (index, value) order.

public static <E> Map<Integer, E>

Returns:

a Map (since the keys/indices are unique) containing the elements from the iterable zipped with indices
indexed
(Iterable<E>
an Iterable
self
,
int
an index to start from
offset
)

Zips an Iterable with indices in (index, value) order.

public static Map<Integer, Integer>
indexed(int[] self)

Zips an int[] with indices in (index, value) order starting from index 0.

public static Map<Integer, Integer>

Returns:

a Map (since the keys/indices are unique) containing the elements from the iterable zipped with indices
indexed
(int[]
an Iterable
self
,
int
an index to start from
offset
)

Zips an int[] with indices in (index, value) order.

public static Map<Integer, Long>
indexed(long[] self)

Zips a long[] with indices in (index, value) order starting from index 0.

public static Map<Integer, Long>

Returns:

a Map (since the keys/indices are unique) containing the elements from the iterable zipped with indices
indexed
(long[]
a long[]
self
,
int
an index to start from
offset
)

Zips a long[] with indices in (index, value) order.

public static Map<Integer, Double>
indexed(double[] self)

Zips a double[] with indices in (index, value) order starting from index 0.

public static Map<Integer, Double>

Returns:

a Map (since the keys/indices are unique) containing the elements from the iterable zipped with indices
indexed
(double[]
a double[]
self
,
int
an index to start from
offset
)

Zips a double[] with indices in (index, value) order.

public static <E> Iterator<Tuple2<Integer, E>>

Returns:

a zipped iterator with indices
indexed
(Iterator<E>
an iterator
self
)

Zips an iterator with indices in (index, value) order.

public static <E> Iterator<Tuple2<Integer, E>>

Returns:

a zipped iterator with indices
indexed
(Iterator<E>
an iterator
self
,
int
an index to start from
offset
)

Zips an iterator with indices in (index, value) order.

public static <T> Collection<T>

Returns:

a Collection without its last element
init
(Iterable<T>
an Iterable
self
)

Returns the items from the Iterable excluding the last item.

public static <T> List<T>

Returns:

a List without its last element
init
(List<T>
a List
self
)

Returns the items from the List excluding the last item.

public static <T> SortedSet<T>

Returns:

a SortedSet without its last element
init
(SortedSet<T>
a SortedSet
self
)

Returns the items from the SortedSet excluding the last item.

public static <T> Iterator<T>

Returns:

an Iterator without the last element from the original Iterator
init
(Iterator<T>
an Iterator
self
)

Returns an Iterator containing all of the items from this iterator except the last one.

public static <T> T[]

Returns:

an array without its last element
init
(T[]
an array
self
)

Returns the items from the Object array excluding the last item.

public static <T> List<List<T>>

Returns:

a List of the init values from the given Iterable
inits
(Iterable<T>
an Iterable
self
)

Calculates the init values of this Iterable: the first value will be this list of all items from the iterable and the final one will be an empty list, with the intervening values the results of successive applications of init on the items.

public static <T, V extends T> T

Returns:

the result of the last closure call
inject
(Collection<T>
a Collection
self
,
Closure<V>
a closure
closure
)

Performs the same function as the version of inject that takes an initial value, but uses the head of the Collection as the initial value, and iterates over the tail.

public static <E, T, U extends T, V extends T> T

Returns:

the result of the last closure call
inject
(Collection<E>
a Collection
self
,
U
some initial value
initialValue
,
Closure<V>
a closure
closure
)

Iterates through the given Collection, passing in the initial value to the 2-arg closure along with the first item.

public static <K, V, T, U extends T, W extends T> T

Returns:

the result of the last closure call
inject
(Map<K, V>
a Map
self
,
U
some initial value
initialValue
,
Closure<W>
a 2 or 3 arg Closure
closure
)

Iterates through the given Map, passing in the initial value to the 2-arg Closure along with the first item (or 3-arg Closure along with the first key and value).

public static <E, T, U extends T, V extends T> T

Returns:

the result of the last closure call
inject
(Iterator<E>
an Iterator
self
,
U
some initial value
initialValue
,
Closure<V>
a closure
closure
)

Iterates through the given Iterator, passing in the initial value to the closure along with the first item.

public static <T, V extends T> T

Returns:

the result of the last closure call
inject
(Object
an Object
self
,
Closure<V>
a closure
closure
)

Iterates through the given Object, passing in the first value to the closure along with the first item.

public static <T, U extends T, V extends T> T

Returns:

the result of the last closure call
inject
(Object
an Object
self
,
U
some initial value
initialValue
,
Closure<V>
a closure
closure
)

Iterates through the given Object, passing in the initial value to the closure along with the first item.

public static <E, T, V extends T> T

Returns:

the result of the last closure call
inject
(E[]
an Object[]
self
,
Closure<V>
a closure
closure
)

Iterates through the given array as with inject(Object[],initialValue,closure), but using the first element of the array as the initialValue, and then iterating the remaining elements of the array.

public static <E, T, U extends T, V extends T> T

Returns:

the result of the last closure call
inject
(E[]
an Object[]
self
,
U
some initial value
initialValue
,
Closure<V>
a closure
closure
)

Iterates through the given array, passing in the initial value to the closure along with the first item.

public static String

Returns:

a String that matches what would be typed into a terminal to create this object. e.g. [1, 'hello'].inspect() -> [1, "hello"]
inspect
(Object
any Object
self
)

Inspects returns the String that matches what would be typed into a terminal to create this object.

public static Number

Returns:

a Number (an Integer) resulting from the integer division operation
intdiv
(Character
a Character
left
,
Number
a Number
right
)

Integer Divide a Character by a Number.

public static Number

Returns:

a Number (an Integer) resulting from the integer division operation
intdiv
(Number
a Number
left
,
Character
a Character
right
)

Integer Divide a Number by a Character.

public static Number

Returns:

a Number (an Integer) resulting from the integer division operation
intdiv
(Character
a Character
left
,
Character
another Character
right
)

Integer Divide two Characters.

public static Number

Returns:

a Number (an Integer) resulting from the integer division operation
intdiv
(Number
a Number
left
,
Number
another Number
right
)

Integer Divide two Numbers.

public static <T> Collection<T>

Returns:

a Collection as an intersection of both collections
intersect
(Collection<T>
a Collection
left
,
Collection<T>
a Collection
right
)

Create a Collection composed of the intersection of both collections.

public static <T> Collection<T>

Returns:

a Collection as an intersection of both collections
intersect
(Collection<T>
a Collection
left
,
Collection<T>
a Collection
right
,
Comparator<T>
a Comparator
comparator
)

Create a Collection composed of the intersection of both collections.

public static <T> Collection<T>

Returns:

a Collection as an intersection of both iterables
intersect
(Iterable<T>
an Iterable
left
,
Iterable<T>
an Iterable
right
)

Create a Collection composed of the intersection of both iterables.

public static <T> Collection<T>

Returns:

a Collection as an intersection of both iterables
intersect
(Iterable<T>
an Iterable
left
,
Iterable<T>
an Iterable
right
,
Comparator<T>
a Comparator
comparator
)

Create a Collection composed of the intersection of both iterables.

public static <T> List<T>

Returns:

a List as an intersection of a List and an Iterable
intersect
(List<T>
a List
left
,
Iterable<T>
an Iterable
right
)

Create a List composed of the intersection of a List and an Iterable.

public static <T> List<T>

Returns:

a List as an intersection of a List and an Iterable
intersect
(List<T>
a List
left
,
Iterable<T>
an Iterable
right
,
Comparator<T>
a Comparator
comparator
)

Create a List composed of the intersection of a List and an Iterable.

public static <T> Set<T>

Returns:

a Set as an intersection of a Set and an Iterable
intersect
(Set<T>
a Set
left
,
Iterable<T>
an Iterable
right
)

Create a Set composed of the intersection of a Set and an Iterable.

public static <T> Set<T>

Returns:

a Set as an intersection of a Set and an Iterable
intersect
(Set<T>
a Set
left
,
Iterable<T>
an Iterable
right
,
Comparator<T>
a Comparator
comparator
)

Create a Set composed of the intersection of a Set and an Iterable.

public static <T> SortedSet<T>

Returns:

a Set as an intersection of a SortedSet and an Iterable
intersect
(SortedSet<T>
a SortedSet
left
,
Iterable<T>
an Iterable
right
)

Create a SortedSet composed of the intersection of a SortedSet and an Iterable.

public static <T> SortedSet<T>

Returns:

a Set as an intersection of a SortedSet and an Iterable
intersect
(SortedSet<T>
a SortedSet
left
,
Iterable<T>
an Iterable
right
,
Comparator<T>
a Comparator
comparator
)

Create a SortedSet composed of the intersection of a SortedSet and an Iterable.

public static <K, V> Map<K, V>

Returns:

a Map as an intersection of both maps
intersect
(Map<K, V>
a map
left
,
Map<K, V>
a map
right
)

Create a Map composed of the intersection of both maps.

private static Object
invokeAsType(Object element, Class<?> elementType)

public static Object

Returns:

the result of the method call
invokeMethod
(Object
any Object
object
,
String
the name of the method to call
method
,
Object
the arguments to use
arguments
)

Provide a dynamic method invocation method which can be overloaded in classes to implement dynamic proxies easily.

public static boolean

Returns:

true if self and other are both references to the same instance, false otherwise
is
(Object
an object
self
,
Object
an object to compare identity with
other
)

Identity check.

public static Boolean

Returns:

true if left is equal to or bigger than right
isAtLeast
(BigDecimal
a BigDecimal
left
,
BigDecimal
a BigDecimal
right
)

Compare a BigDecimal to another.

public static Boolean

Returns:

true if left is equal to or bigger than the value represented by right
isAtLeast
(BigDecimal
a BigDecimal
left
,
String
a String representing a number
right
)

Compare a BigDecimal to a String representing a number.

public static boolean

Returns:

true if the switchValue is deemed to be equal to the caseValue
isCase
(Object
the case value
caseValue
,
Object
the switch value
switchValue
)

Method for overloading the behavior of the 'case' method in switch statements.

public static boolean

Returns:

true if the switchValue is deemed to be assignable from the given class
isCase
(Class<T>
the case value
caseValue
,
Object
the switch value
switchValue
)

Special 'Case' implementation for Class, which allows testing whether some switch value is assignable from the given case class.

public static boolean

Returns:

true if the caseValue is deemed to contain the switchValue
isCase
(Collection<E>
the case value
caseValue
,
Object
the switch value
switchValue
)

'Case' implementation for collections which tests if the 'switch' operand is contained in any of the 'case' values.

public static boolean

Returns:

the groovy truth value from caseValue corresponding to the switchValue key
isCase
(Map<K, V>
the case value
caseValue
,
Object
the switch value
switchValue
)

'Case' implementation for maps which tests the groovy truth value obtained using the 'switch' operand as key.

public static boolean

Returns:

true if the numbers are deemed equal
isCase
(Number
the case value
caseValue
,
Number
the switch value
switchValue
)

Special 'case' implementation for all numbers, which delegates to the compareTo() method for comparing numbers of different types.

public static boolean

Returns:

true if the character is a digit
isDigit
(Character
a Character
self
)

Determines if a character is a digit.

public static boolean

Returns:

true if the iterable has no elements, false otherwise
isEmpty
(Iterable<T>
an Iterable
self
)

Check whether an Iterable has elements

def items = [1]
def iterable = { [ hasNext:{ !items.isEmpty() }, next:{ items.pop() } ] as Iterator } as Iterable
assert !iterable.isEmpty()
iterable.iterator().next()
assert iterable.isEmpty()
public static boolean

Returns:

true if the character is a letter
isLetter
(Character
a Character
self
)

Determines if a character is a letter.

public static boolean

Returns:

true if the character is a letter or digit
isLetterOrDigit
(Character
a Character
self
)

Determines if a character is a letter or digit.

public static boolean

Returns:

true if the character is lowercase
isLowerCase
(Character
a Character
self
)

Determine if a Character is lowercase.

private static boolean
public static boolean

Returns:

true if the character is uppercase
isUpperCase
(Character
a Character
self
)

Determine if a Character is uppercase.

public static boolean

Returns:

true if the character is a whitespace character
isWhitespace
(Character
a Character
self
)

Determines if a character is a whitespace character.

public static <T> Iterator<T>

Returns:

an Iterator for the given Array.
iterator
(T[]
an array
a
)

Attempts to create an Iterator for the given object by first converting it to a Collection.

public static Iterator<E>

Returns:

an Iterator for the given Object.
iterator
(final Object
an object
o
)

Attempts to create an Iterator for the given object by first converting it to a Collection.

public static <T> Iterator<T>

Returns:

an Iterator for the given Enumeration
iterator
(final Enumeration<T>
an Enumeration object
enumeration
)

Allows an Enumeration to behave like an Iterator.

public static <T> Iterator<T>

Returns:

itself
iterator
(Iterator<T>
an iterator object
self
)

An identity function for iterators, supporting 'duck-typing' when trying to get an iterator for each object within a collection, some of which may already be iterators.

public static String
join(Collection<E> self, String separator)

Deprecated Use the Iterable version of join instead
public static String

Returns:

the joined String
join
(Iterator<?>
an Iterator of items
self
,
String
a String separator
separator
)

Concatenates the toString() representation of each item from the iterator, with the given String as a separator between each item.

public static String

Returns:

the joined String
join
(Iterable<?>
an Iterable of objects
self
,
String
a String separator
separator
)

Concatenates the toString() representation of each item in this Iterable, with the given String as a separator between each item.

public static <T> String

Returns:

the joined String
join
(T[]
an array of Object
self
,
String
a String separator
separator
)

Concatenates the toString() representation of each items in this array, with the given String as a separator between each item.

public static String

Returns:

the joined String
join
(boolean[]
an array of boolean
self
,
String
a String separator
separator
)

Concatenates the string representation of each items in this array, with the given String as a separator between each item.

public static String

Returns:

the joined String
join
(byte[]
an array of byte
self
,
String
a String separator
separator
)

Concatenates the string representation of each items in this array, with the given String as a separator between each item.

public static String

Returns:

the joined String
join
(char[]
an array of char
self
,
String
a String separator
separator
)

Concatenates the string representation of each items in this array, with the given String as a separator between each item.

public static String

Returns:

the joined String
join
(double[]
an array of double
self
,
String
a String separator
separator
)

Concatenates the string representation of each items in this array, with the given String as a separator between each item.

public static String

Returns:

the joined String
join
(float[]
an array of float
self
,
String
a String separator
separator
)

Concatenates the string representation of each items in this array, with the given String as a separator between each item.

public static String

Returns:

the joined String
join
(int[]
an array of int
self
,
String
a String separator
separator
)

Concatenates the string representation of each items in this array, with the given String as a separator between each item.

public static String

Returns:

the joined String
join
(long[]
an array of long
self
,
String
a String separator
separator
)

Concatenates the string representation of each items in this array, with the given String as a separator between each item.

public static String

Returns:

the joined String
join
(short[]
an array of short
self
,
String
a String separator
separator
)

Concatenates the string representation of each items in this array, with the given String as a separator between each item.

public static <T> T
last(Deque<T> self)

An optimized version of last(List).

public static <T> T

Returns:

the last item from the List
last
(List<T>
a List
self
)

Returns the last item from the List.

public static <T> T

Returns:

the last item from the Iterable
last
(Iterable<T>
an Iterable
self
)

Returns the last item from the Iterable.

public static <T> T

Returns:

the last item from the array
last
(T[]
an array
self
)

Returns the last item from the array.

public static <T> Collection<T>

Returns:

same collection, after the value was added to it.
leftShift
(Collection<T>
a Collection
self
,
T
an Object to be added to the collection.
value
)

Overloads the left shift operator to provide an easy way to append objects to a Collection.

public static <T> List<T>

Returns:

same List, after the value was added to it.
leftShift
(List<T>
a List
self
,
T
an Object to be added to the List.
value
)

Overloads the left shift operator to provide an easy way to append objects to a List.

public static <T> Set<T>

Returns:

same Set, after the value was added to it.
leftShift
(Set<T>
a Set
self
,
T
an Object to be added to the Set.
value
)

Overloads the left shift operator to provide an easy way to append objects to a Set.

public static <T> SortedSet<T>

Returns:

same SortedSet, after the value was added to it.
leftShift
(SortedSet<T>
a SortedSet
self
,
T
an Object to be added to the SortedSet.
value
)

Overloads the left shift operator to provide an easy way to append objects to a SortedSet.

public static <T> BlockingQueue<T>

Returns:

same collection, after the value was added to it.
leftShift
(BlockingQueue<T>
a Collection
self
,
T
an Object to be added to the collection.
value
)

Overloads the left shift operator to provide an easy way to append objects to a BlockingQueue.

public static <K, V> Map<K, V>

Returns:

same map, after the value has been added to it.
leftShift
(Map<K, V>
a Map
self
,
Map.Entry<K, V>
a Map.Entry to be added to the Map.
entry
)

Overloads the left shift operator to provide an easy way to append Map.Entry values to a Map.

public static <K, V> Map<K, V>

Returns:

same map, after the values have been added to it.
leftShift
(Map<K, V>
a Map
self
,
Map<K, V>
another Map whose entries should be added to the original Map.
other
)

Overloads the left shift operator to provide an easy way to put one maps entries into another map.

public static Number

Returns:

the resulting number
leftShift
(Number
a Number object
self
,
Number
the shift distance by which to left shift the number
operand
)

Implementation of the left shift operator for integral types.

public static <K, V> Map.Entry<K, V>

Returns:

the Map.Entry having the maximum value as determined by the closure
max
(Map<K, V>
a Map
self
,
Closure<V>
a 1 or 2 arg Closure used to determine the correct ordering
closure
)

Selects an entry in the map having the maximum calculated value as determined by the supplied closure.

public static <T> T
max(Collection<T> self)

Deprecated Use the Iterable version of max instead
public static <T> T

Returns:

the maximum value
max
(Iterable<T>
an Iterable
self
)

Adds max() method to Iterable objects.

public static <T> T

Returns:

the maximum value
max
(Iterator<T>
an Iterator
self
)

Adds max() method to Iterator objects.

public static <T> T

Returns:

the maximum value
max
(T[]
an array
self
)

Adds max() method to Object arrays.

public static <T> T
max(Collection<T> self, Closure<V> closure)

Deprecated Use the Iterable version of max instead
public static int

Returns:

the maximum value
max
(int[]
an int array
self
)

Adds max() method to int arrays.

public static long

Returns:

the maximum value
max
(long[]
a long array
self
)

Adds max() method to long arrays.

public static double

Returns:

the maximum value
max
(double[]
a double array
self
)

Adds max() method to double arrays.

public static <T> T

Returns:

an item from the Iterable having the maximum value returned by calling the supplied closure with that item as parameter or null for an empty Iterable
max
(Iterable<T>
an Iterable
self
,
Closure<V>
a 1 or 2 arg Closure used to determine the correct ordering
closure
)

Selects the item in the iterable which when passed as a parameter to the supplied closure returns the maximum value.

public static <T> T

Returns:

the maximum value
max
(Iterator<T>
an Iterator
self
,
Closure<V>
a Closure used to determine the correct ordering
closure
)

Selects the maximum value found from the Iterator using the closure to determine the correct ordering.

public static <T> T

Returns:

the maximum value
max
(T[]
an array
self
,
Closure<V>
a Closure used to determine the correct ordering
closure
)

Selects the maximum value found from the Object array using the closure to determine the correct ordering.

public static <T> T
max(Collection<T> self, Comparator<T> comparator)

Deprecated Use the Iterable version of max instead
public static <T> T

Returns:

the maximum value or null for an empty Iterable
max
(Iterable<T>
an Iterable
self
,
Comparator<T>
a Comparator
comparator
)

Selects the maximum value found in the Iterable using the given comparator.

public static <T> T

Returns:

the maximum value
max
(Iterator<T>
an Iterator
self
,
Comparator<T>
a Comparator
comparator
)

Selects the maximum value found from the Iterator using the given comparator.

public static <T> T

Returns:

the maximum value
max
(T[]
an array
self
,
Comparator<T>
a Comparator
comparator
)

Selects the maximum value found from the Object array using the given comparator.

public static MetaClass

Returns:

the new metaclass value
metaClass
(Class<T>
the class whose metaclass we wish to update
self
,
Closure<V>
the closure representing the new metaclass
closure
)

Sets/updates the metaclass for a given class to a closure.

public static MetaClass

Returns:

the new metaclass value
metaClass
(Object
the object whose metaclass we wish to update
self
,
Closure<V>
the closure representing the new metaclass
closure
)

Sets/updates the metaclass for a given object to a closure.

public static <T> T
min(Collection<T> self)

Deprecated Use the Iterable version of min instead
public static <T> T

Returns:

the minimum value
min
(Iterable<T>
a Collection
self
)

Adds min() method to Collection objects.

public static <T> T

Returns:

the minimum value
min
(Iterator<T>
an Iterator
self
)

Adds min() method to Iterator objects.

public static <T> T

Returns:

the minimum value
min
(T[]
an array
self
)

Adds min() method to Object arrays.

public static <T> T
min(Collection<T> self, Comparator<T> comparator)

Deprecated Use the Iterable version of min instead
public static int

Returns:

the minimum value
min
(int[]
an int array
self
)

Adds min() method to int arrays.

public static long

Returns:

the minimum value
min
(long[]
a long array
self
)

Adds min() method to long arrays.

public static double

Returns:

the minimum value
min
(double[]
a double array
self
)

Adds min() method to double arrays.

public static <T> T

Returns:

the minimum value or null for an empty Iterable
min
(Iterable<T>
an Iterable
self
,
Comparator<T>
a Comparator
comparator
)

Selects the minimum value found in the Iterable using the given comparator.

public static <T> T

Returns:

the minimum value
min
(Iterator<T>
an Iterator
self
,
Comparator<T>
a Comparator
comparator
)

Selects the minimum value found from the Iterator using the given comparator.

public static <T> T

Returns:

the minimum value
min
(T[]
an array
self
,
Comparator<T>
a Comparator
comparator
)

Selects the minimum value found from the Object array using the given comparator.

public static <T> T
min(Collection<T> self, Closure<V> closure)

Deprecated Use the Iterable version of min instead
public static <T> T

Returns:

an item from the Iterable having the minimum value returned by calling the supplied closure with that item as parameter or null for an empty Iterable
min
(Iterable<T>
an Iterable
self
,
Closure<V>
a 1 or 2 arg Closure used to determine the correct ordering
closure
)

Selects the item in the iterable which when passed as a parameter to the supplied closure returns the minimum value.

public static <K, V> Map.Entry<K, V>

Returns:

the Map.Entry having the minimum value as determined by the closure
min
(Map<K, V>
a Map
self
,
Closure<V>
a 1 or 2 arg Closure used to determine the correct ordering
closure
)

Selects an entry in the map having the minimum calculated value as determined by the supplied closure.

public static <T> T

Returns:

the minimum value
min
(Iterator<T>
an Iterator
self
,
Closure<V>
a Closure used to determine the correct ordering
closure
)

Selects the minimum value found from the Iterator using the closure to determine the correct ordering.

public static <T> T

Returns:

the minimum value
min
(T[]
an array
self
,
Closure<V>
a Closure used to determine the correct ordering
closure
)

Selects the minimum value found from the Object array using the closure to determine the correct ordering.

public static <T> Set<T>

Returns:

the resulting Set
minus
(Set<T>
a Set object
self
,
Collection<?>
the items to remove from the Set
removeMe
)

Create a Set composed of the elements of the first Set minus the elements of the given Collection.

public static <T> Set<T>

Returns:

the resulting Set
minus
(Set<T>
a Set object
self
,
Iterable<?>
the items to remove from the Set
removeMe
)

Create a Set composed of the elements of the first Set minus the elements from the given Iterable.

public static <T> Set<T>

Returns:

the resulting Set
minus
(Set<T>
a Set object
self
,
Object
the element to remove from the Set
removeMe
)

Create a Set composed of the elements of the first Set minus the given element.

public static <T> SortedSet<T>

Returns:

the resulting SortedSet
minus
(SortedSet<T>
a SortedSet object
self
,
Collection<?>
the items to remove from the SortedSet
removeMe
)

Create a SortedSet composed of the elements of the first SortedSet minus the elements of the given Collection.

public static <T> SortedSet<T>

Returns:

the resulting SortedSet
minus
(SortedSet<T>
a SortedSet object
self
,
Iterable<?>
the items to remove from the SortedSet
removeMe
)

Create a SortedSet composed of the elements of the first SortedSet minus the elements of the given Iterable.

public static <T> SortedSet<T>

Returns:

the resulting SortedSet
minus
(SortedSet<T>
a SortedSet object
self
,
Object
the element to remove from the SortedSet
removeMe
)

Create a SortedSet composed of the elements of the first SortedSet minus the given element.

public static <T> T[]

Returns:

an array with the supplied elements removed
minus
(T[]
an array
self
,
Iterable<T>
an Iterable of elements to remove
removeMe
)

Create a new array composed of the elements of the first array minus the elements of the given Iterable.

public static <T> T[]

Returns:

an array with the supplied elements removed
minus
(T[]
an array
self
,
Object[]
an array of elements to remove
removeMe
)

Create a new array composed of the elements of the first array minus the elements of the given array.

public static <T> List<T>

Returns:

a List with the given elements removed
minus
(List<T>
a List
self
,
Collection<?>
a Collection of elements to remove
removeMe
)

Create a List composed of the elements of the first list minus every occurrence of elements of the given Collection.

public static <T> Collection<T>

Returns:

a Collection with the given elements removed
minus
(Collection<T>
a Collection
self
,
Collection<?>
a Collection of elements to remove
removeMe
)

Create a new Collection composed of the elements of the first Collection minus every occurrence of elements of the given Collection.

public static <T> List<T>

Returns:

a new List with the given elements removed
minus
(List<T>
a List
self
,
Iterable<?>
an Iterable of elements to remove
removeMe
)

Create a new List composed of the elements of the first List minus every occurrence of elements of the given Iterable.

public static <T> Collection<T>

Returns:

a new Collection with the given elements removed
minus
(Iterable<T>
an Iterable
self
,
Iterable<?>
an Iterable of elements to remove
removeMe
)

Create a new Collection composed of the elements of the first Iterable minus every occurrence of elements of the given Iterable.

public static <T> List<T>

Returns:

the resulting List with the given element removed
minus
(List<T>
a List object
self
,
Object
an element to remove from the List
removeMe
)

Create a new List composed of the elements of the first List minus every occurrence of the given element to remove.

public static <T> Collection<T>

Returns:

the resulting Collection with the given element removed
minus
(Iterable<T>
an Iterable object
self
,
Object
an element to remove from the Iterable
removeMe
)

Create a new Collection composed of the elements of the first Iterable minus every occurrence of the given element to remove.

public static <T> T[]

Returns:

a new array with the operand removed
minus
(T[]
an array
self
,
Object
an element to remove from the array
removeMe
)

Create a new array composed of the elements of the first array minus the element to remove.

public static <K, V> Map<K, V>

Returns:

the resulting map
minus
(Map<K, V>
a map object
self
,
Map<K, V>
the entries to remove from the map
removeMe
)

Create a Map composed of the entries of the first map minus the entries of the given map.

public static Number

Returns:

the Number corresponding to the subtraction of right from left
minus
(Character
a Character
left
,
Number
a Number
right
)

Subtract a Number from a Character.

public static Number

Returns:

the Number corresponding to the subtraction of right from left
minus
(Number
a Number
left
,
Character
a Character
right
)

Subtract a Character from a Number.

public static Number

Returns:

the Number corresponding to the subtraction of right from left
minus
(Character
a Character
left
,
Character
a Character
right
)

Subtract one Character from another.

public static void
mixin(MetaClass
any Class
self
,
List<Class<T>>
a category classes to use
categoryClasses
)

Extend object with category methods.

public static void
mixin(Class<T>
any Class
self
,
List<Class<T>>
a category classes to use
categoryClasses
)

Extend class globally with category methods.

public static void
mixin(Class<T>
any Class
self
,
Class<T>
a category class to use
categoryClass
)

Extend class globally with category methods.

public static void
mixin(Class<T>
any Class
self
,
Class<T>[]
a category class to use
categoryClass
)

Extend class globally with category methods.

public static void
mixin(MetaClass
any Class
self
,
Class<T>
a category class to use
categoryClass
)

Extend class globally with category methods.

public static void
mixin(MetaClass
any Class
self
,
Class<T>[]
a category class to use
categoryClass
)

Extend class globally with category methods.

public static Number

Returns:

the modulus result
mod
(Number
a Number
left
,
Number
another Number to mod
right
)

Performs a division modulus operation.

public static <T> Collection<T>
multiply(Collection<T> self, Number factor)

Deprecated use the Iterable variant instead
public static <T> Collection<T>

Returns:

the multiplied Collection
multiply
(Iterable<T>
an Iterable
self
,
Number
the number of times to append
factor
)

Create a Collection composed of the elements of this Iterable, repeated a certain number of times.

public static <T> List<T>

Returns:

the multiplied List
multiply
(List<T>
a List
self
,
Number
the number of times to append
factor
)

Create a List composed of the elements of this Iterable, repeated a certain number of times.

public static Number

Returns:

the Number corresponding to the multiplication of left by right
multiply
(Character
a Character
left
,
Number
a Number
right
)

Multiply a Character by a Number.

public static Number

Returns:

the multiplication of left by right
multiply
(Number
a Number
left
,
Character
a Character
right
)

Multiply a Number by a Character.

public static Number

Returns:

the Number corresponding to the multiplication of left by right
multiply
(Character
a Character
left
,
Character
another Character
right
)

Multiply two Characters.

public static Number

Returns:

the multiplication of left by right
multiply
(BigDecimal
a BigDecimal
left
,
Double
a Double
right
)

Multiply a BigDecimal and a Double.

public static Number

Returns:

the multiplication of left by right
multiply
(BigDecimal
a BigDecimal
left
,
BigInteger
a BigInteger
right
)

Multiply a BigDecimal and a BigInteger.

public static <T> T

Returns:

a new instance of this class
newInstance
(Class<T>
a class
c
)

Convenience method to dynamically create a new instance of this class.

public static <T> T

Returns:

a new instance of this class.
newInstance
(Class<T>
a class
c
,
Object[]
the constructor arguments
args
)

Helper to construct a new instance from the given arguments.

public static Character

Returns:

an incremented Character
next
(Character
a Character
self
)

Increment a Character by one.

public static Number

Returns:

an incremented Number
next
(Number
a Number
self
)

Increment a Number by one.

public static int

Returns:

a -ve number, 0 or a +ve number according to Groovy's compareTo contract
numberAwareCompareTo
(Comparable<T>
a Comparable
self
,
Comparable<T>
another Comparable
other
)

Provides a method that compares two comparables using Groovy's default number aware comparator.

public static Number

Returns:

the bitwise OR of both Numbers
or
(Number
a Number
left
,
Number
another Number to bitwise OR
right
)

Bitwise OR together two numbers.

public static BitSet

Returns:

the bitwise OR of both BitSets
or
(BitSet
a BitSet
left
,
BitSet
another BitSet to bitwise OR
right
)

Bitwise OR together two BitSets.

public static Boolean

Returns:

result of logical disjunction
or
(Boolean
left operator
left
,
Boolean
right operator
right
)

Logical disjunction of two boolean operators

public static <T> Set<List<T>>

Returns:

the permutations from the list
permutations
(Iterable<T>
the Iterable of items
self
)

Finds all permutations of an iterable.

public static <T, V> List<V>

Returns:

the list of results of the application of the function on each permutation
permutations
(Iterable<T>
the Iterable of items
self
,
Closure<V>
the function to apply on each permutation
function
)

Finds all permutations of an iterable, applies a function to each permutation and collects the result into a list.

public static <T, V> List<V>
permutations(List<T> self, Closure<V> function)

Deprecated Use the Iterable version of permutations instead
public static <K, V> Map<K, V>

Returns:

a new Map containing all entries from left and right
plus
(Map<K, V>
a Map
left
,
Map<K, V>
a Map
right
)

Returns a new Map containing all entries from left and right, giving precedence to right.

public static <K, V> Map<K, V>

Returns:

a new Map containing all key, value pairs from self and entries
plus
(Map<K, V>
a Map
self
,
Collection<? extends Map.Entry<? extends K, ? extends V>>
a Collection of Map.Entry items to be added to the Map.
entries
)

Returns a new Map containing all entries from self and entries, giving precedence to entries.

public static <T> T[]

Returns:

A new array containing right appended to left.
plus
(T[]
the left Array
left
,
T[]
the right Array
right
)

Create an array as a union of two arrays.

public static <T> T[]

Returns:

A new array containing left with right appended to it.
plus
(T[]
the array
left
,
T
the value to append
right
)

Create an array containing elements from an original array plus an additional appended element.

public static <T> T[]

Returns:

A new array containing left with right appended to it.
plus
(T[]
the array
left
,
Collection<T>
a Collection to be appended
right
)

Create an array containing elements from an original array plus those from a Collection.

public static <T> T[]

Returns:

A new array containing elements from left with those from right appended.
plus
(T[]
the array
left
,
Iterable<T>
an Iterable to be appended
right
)

Create an array containing elements from an original array plus those from an Iterable.

public static <T> Collection<T>

Returns:

the merged Collection
plus
(Collection<T>
the left Collection
left
,
Collection<T>
the right Collection
right
)

Create a Collection as a union of two collections.

public static <T> Collection<T>

Returns:

the merged Collection
plus
(Iterable<T>
the left Iterable
left
,
Iterable<T>
the right Iterable
right
)

Create a Collection as a union of two iterables.

public static <T> Collection<T>

Returns:

the merged Collection
plus
(Collection<T>
the left Collection
left
,
Iterable<T>
the right Iterable
right
)

Create a Collection as a union of a Collection and an Iterable.

public static <T> List<T>

Returns:

the merged List
plus
(List<T>
the left List
left
,
Iterable<T>
the right Iterable
right
)

Create a List as a union of a List and an Iterable.

public static <T> List<T>

Returns:

the merged List
plus
(List<T>
the left List
left
,
Collection<T>
the right Collection
right
)

Create a List as a union of a List and a Collection.

public static <T> Set<T>

Returns:

the merged Set
plus
(Set<T>
the left Set
left
,
Iterable<T>
the right Iterable
right
)

Create a Set as a union of a Set and an Iterable.

public static <T> Set<T>

Returns:

the merged Set
plus
(Set<T>
the left Set
left
,
Collection<T>
the right Collection
right
)

Create a Set as a union of a Set and a Collection.

public static <T> SortedSet<T>

Returns:

the merged SortedSet
plus
(SortedSet<T>
the left SortedSet
left
,
Iterable<T>
the right Iterable
right
)

Create a SortedSet as a union of a SortedSet and an Iterable.

public static <T> SortedSet<T>

Returns:

the merged SortedSet
plus
(SortedSet<T>
the left SortedSet
left
,
Collection<T>
the right Collection
right
)

Create a SortedSet as a union of a SortedSet and a Collection.

public static <T> List<T>

Returns:

the new list
plus
(List<T>
an original list
self
,
int
index at which to insert the first element from the specified array
index
,
T[]
array containing elements to be merged with elements from the original list
items
)

Creates a new List by inserting all of the elements in the specified array to the elements from the original List at the specified index.

public static <T> List<T>

Returns:

the new list
plus
(List<T>
an original List
self
,
int
index at which to insert the first element from the given additions List
index
,
List<T>
a List containing elements to be merged with elements from the original List
additions
)

Creates a new List by inserting all of the elements in the given additions List to the elements from the original List at the specified index.

public static <T> List<T>

Returns:

the new list
plus
(List<T>
an original list
self
,
int
index at which to insert the first element from the given additions Iterable
index
,
Iterable<T>
an Iterable containing elements to be merged with the elements from the original List
additions
)

Creates a new List by inserting all of the elements in the given Iterable to the elements from this List at the specified index.

public static <T> Collection<T>

Returns:

the resulting Collection
plus
(Collection<T>
a Collection
left
,
T
an object to add/append
right
)

Create a collection as a union of a Collection and an Object.

public static <T> Collection<T>

Returns:

the resulting Collection
plus
(Iterable<T>
an Iterable
left
,
T
an object to add/append
right
)

Create a collection as a union of an Iterable and an Object.

public static <T> List<T>

Returns:

the resulting List
plus
(List<T>
a List
left
,
T
an object to add/append
right
)

Create a List as a union of a List and an Object.

public static <T> Set<T>

Returns:

the resulting Set
plus
(Set<T>
a Set
left
,
T
an object to add/append
right
)

Create a Set as a union of a Set and an Object.

public static <T> SortedSet<T>

Returns:

the resulting SortedSet
plus
(SortedSet<T>
a SortedSet
left
,
T
an object to add/append
right
)

Create a SortedSet as a union of a SortedSet and an Object.

public static Number

Returns:

the Number corresponding to the addition of left and right
plus
(Character
a Character
left
,
Number
a Number
right
)

Add a Character and a Number.

public static Number

Returns:

The Number corresponding to the addition of left and right
plus
(Number
a Number
left
,
Character
a Character
right
)

Add a Number and a Character.

public static Number

Returns:

the Number corresponding to the addition of left and right
plus
(Character
a Character
left
,
Character
a Character
right
)

Add one Character to another.

public static <T> T

Returns:

the item removed from the List
pop
(List<T>
a List
self
)

Removes the initial item from the List.

public static Number

Returns:

a Number to the power of a certain exponent
power
(Number
a Number
self
,
Number
a Number exponent
exponent
)

Power of a Number to a certain exponent.

public static Number

Returns:

a Number to the power of a the exponent
power
(BigDecimal
a BigDecimal
self
,
Integer
an Integer exponent
exponent
)

Power of a BigDecimal to an integer certain exponent.

public static Number

Returns:

a Number to the power of a the exponent
power
(BigInteger
a BigInteger
self
,
Integer
an Integer exponent
exponent
)

Power of a BigInteger to an integer certain exponent.

public static Number

Returns:

a Number to the power of a the exponent
power
(Integer
an Integer
self
,
Integer
an Integer exponent
exponent
)

Power of an integer to an integer certain exponent.

public static Number

Returns:

a Number to the power of a the exponent
power
(Long
a Long
self
,
Integer
an Integer exponent
exponent
)

Power of a long to an integer certain exponent.

public static BigInteger

Returns:

a BigInteger to the power of a the exponent
power
(BigInteger
a BigInteger
self
,
BigInteger
a BigInteger exponent
exponent
)

Power of a BigInteger to a BigInteger certain exponent.

public static Character

Returns:

a decremented Character
previous
(Character
a Character
self
)

Decrement a Character by one.

public static Number

Returns:

a decremented Number
previous
(Number
a Number
self
)

Decrement a Number by one.

protected static Object

Returns:

the returned value from the array
primitiveArrayGet
(Object
an array object
self
,
int
the index of interest
idx
)

Implements the getAt(int) method for primitive type arrays.

protected static List<E>

Returns:

the returned values from the array corresponding to the range
primitiveArrayGet
(Object
an array object
self
,
Range<T extends Comparable<T>>
the range of indices of interest
range
)

Implements the getAt(Range) method for primitive type arrays.

protected static List<E>

Returns:

the returned values from the array
primitiveArrayGet
(Object
an array object
self
,
Collection<E>
the indices of interest
indices
)

Implements the getAt(Collection) method for primitive type arrays.

protected static Object

Returns:

the added value
primitiveArrayPut
(Object
an object
self
,
int
the index of interest
idx
,
Object
the new value to be put into the index of interest
newValue
)

Implements the setAt(int idx) method for primitive type arrays.

public static void
printf(Object
any Object
self
,
String
a format string
format
,
Object[]
values referenced by the format specifiers in the format string
values
)

Printf to the standard output stream.

public static void
printf(Closure<V>
a generated closure
self
,
String
a format string
format
,
Object[]
values referenced by the format specifiers in the format string
values
)

Printf 0 or more values to the standard output stream using a format string.

public static void
printf(Closure<V>
a generated closure
self
,
String
a format string
format
,
Object
value referenced by the format specifier in the format string
value
)

Printf a value to the standard output stream using a format string.

public static void
printf(Object
any Object
self
,
String
A format string
format
,
Object
Argument which is referenced by the format specifiers in the format string. The type of arg should be one of Object[], List, int[], short[], byte[], char[], boolean[], long[], float[], or double[].
arg
)

Prints a formatted string using the specified format string and arguments.

private static void
printf(PrintStream self, String format, Object arg)

private static void
printf(Writer self, String format, Object arg)

public static void
println(Object
any Object
self
)

Print a linebreak to the standard output stream.

public static void
println(Closure<V>
a closure
self
)

Print a linebreak to the standard output stream.

public static void
println(Object
any Object
self
,
Object
the value to print
value
)

Print a value formatted Groovy style (followed by a newline) to self if it is a Writer, otherwise to the standard output stream.

public static void
println(PrintWriter
a PrintWriter
self
,
Object
the value to print
value
)

Print a value formatted Groovy style (followed by a newline) to the print writer.

public static void
println(PrintStream
any Object
self
,
Object
the value to print
value
)

Print a value formatted Groovy style (followed by a newline) to the print stream.

public static void
println(Closure<V>
a closure
self
,
Object
the value to print
value
)

Print a value (followed by a newline) to the standard output stream.

public static void
println(Object
any Object
self
,
PrintWriter
the PrintWriter used for printing
out
)

Print to a console in interactive format.

public static <T> boolean

Returns:

true (for legacy compatibility reasons).
push
(List<T>
a List
self
,
T
element to be prepended to this list.
value
)

Prepends an item to the start of the List.

public static <K, V> Map<K, V>

Returns:

the same map, after the items have been added to it.
putAll
(Map<K, V>
a Map
self
,
Collection<? extends Map.Entry<? extends K, ? extends V>>
a Collection of Map.Entry items to be added to the Map.
entries
)

Provides an easy way to append multiple Map.Entry values to a Map.

public static void
putAt(Object
the object to act upon
self
,
String
the name of the property to set
property
,
Object
the value to set
newValue
)

Allows the subscript operator to be used to set dynamically named property values.

public static <T> void
putAt(List<T>
a List
self
,
int
an index
idx
,
T
the value to put at the given index
value
)

A helper method to allow lists to work with subscript operators.

public static <T> void
putAt(List<T> self, Number idx, T value)

Support subscript operator for list modification.

public static void
putAt(List<E>
a List
self
,
EmptyRange<T extends Comparable<T>>
the (in this case empty) subset of the list to set
range
,
Object
the values to put at the given sublist or a Collection of values
value
)

A helper method to allow lists to work with subscript operators.

public static void
putAt(List<E>
a List
self
,
EmptyRange<T extends Comparable<T>>
the (in this case empty) subset of the list to set
range
,
Collection<E>
the Collection of values
value
)

A helper method to allow lists to work with subscript operators.

public static void
putAt(List<E>
a List
self
,
IntRange
the subset of the list to set
range
,
Collection<E>
the collection of values to put at the given sublist
col
)

List subscript assignment operator when given a range as the index and the assignment operand is a collection.

public static void
putAt(List<E>
a List
self
,
IntRange
the subset of the list to set
range
,
Object
the value to put at the given sublist
value
)

List subscript assignment operator when given a range as the index.

public static void
putAt(List<E>
a List
self
,
List<E>
the subset of the list to set
splice
,
List<E>
the value to put at the given sublist
values
)

A helper method to allow lists to work with subscript operators.

public static void
putAt(List<E>
a List
self
,
List<E>
the subset of the list to set
splice
,
Object
the value to put at the given sublist
value
)

A helper method to allow lists to work with subscript operators.

public static <K, V> V

Returns:

the value corresponding to the given key
putAt
(Map<K, V>
a Map
self
,
K
an Object as a key for the map
key
,
V
the value to put into the map
value
)

A helper method to allow maps to work with subscript operators

public static void
putAt(BitSet
a BitSet
self
,
IntRange
the range of values to set
range
,
boolean
value
value
)

Support assigning a range of values with a single assignment statement.

public static void
putAt(BitSet
a BitSet
self
,
int
index of the entry to set
index
,
boolean
value
value
)

Support subscript-style assignment for a BitSet.

public static boolean

Returns:

true if this collection changed as a result of the call
removeAll
(Collection<E>
a Collection to be modified
self
,
Object[]
array containing elements to be removed from this collection
items
)

Modifies this collection by removing its elements that are contained within the specified object array.

public static <T> boolean

Returns:

true if this collection changed as a result of the call
removeAll
(Collection<T>
a Collection to be modified
self
,
Closure<V>
a closure condition
condition
)

Modifies this collection by removing the elements that are matched according to the specified closure condition.

public static <K, V> boolean

Returns:

true if this map changed as a result of the call
removeAll
(Map<K, V>
a Map to be modified
self
,
Closure<V>
a 1 or 2 arg Closure condition applying on the entries
condition
)

Modifies this map by removing the elements that are matched according to the specified closure condition.

public static <E> E

Returns:

the element previously at the specified position
removeAt
(List<E>
a List
self
,
int
the index of the element to be removed
index
)

Modifies this list by removing the element at the specified position in this list.

public static <E> boolean

Returns:

true if an element was removed as a result of this call
removeElement
(Collection<E>
a Collection
self
,
Object
element to be removed from this collection, if present
o
)

Modifies this collection by removing a single instance of the specified element from this collection, if it is present.

public static <T> T

Returns:

the item removed from the List
removeLast
(List<T>
a List
self
)

Removes the last item from the List.

private static <T> List<T>
public static List<MetaMethod>

Returns:

A List of MetaMethods matching the argument types which will be empty if no matching methods exist
respondsTo
(Object
The object to inspect
self
,
String
The name of the method of interest
name
,
Object[]
The argument types to match against
argTypes
)

Returns an object satisfying Groovy truth if the implementing MetaClass responds to a method with the given name and arguments types.

public static List<MetaMethod>

Returns:

A List of MetaMethods matching the given name or an empty list if no matching methods exist
respondsTo
(Object
The object to inspect
self
,
String
The name of the method of interest
name
)

Returns an object satisfying Groovy truth if the implementing MetaClass responds to a method with the given name regardless of the arguments.

public static boolean

Returns:

true if this collection changed as a result of the call
retainAll
(Collection<E>
a Collection to be modified
self
,
Object[]
array containing elements to be retained from this collection
items
)

Modifies this collection so that it retains only its elements that are contained in the specified array.

public static <T> boolean

Returns:

true if this collection changed as a result of the call
retainAll
(Collection<T>
a Collection to be modified
self
,
Closure<V>
a closure condition
condition
)

Modifies this collection so that it retains only its elements that are matched according to the specified closure condition.

public static <K, V> boolean

Returns:

true if this map changed as a result of the call
retainAll
(Map<K, V>
a Map to be modified
self
,
Closure<V>
a 1 or 2 arg Closure condition applying on the entries
condition
)

Modifies this map so that it retains only its elements that are matched according to the specified closure condition.

public static <T> List<T>

Returns:

a reversed List
reverse
(List<T>
a List
self
)

Creates a new List with the identical contents to this list but in reverse order.

public static <T> List<T>

Returns:

a reversed List
reverse
(List<T>
a List
self
,
boolean
true if the list itself should be reversed in place and returned, false if a new list should be created
mutate
)

Reverses the elements in a list.

public static <T> T[]

Returns:

an array containing the reversed items
reverse
(T[]
an array
self
)

Creates a new array containing items which are the same as this array but in reverse order.

public static <T> T[]

Returns:

an array containing the reversed items
reverse
(T[]
an array
self
,
boolean
true if the array itself should be reversed in place, false if a new array should be created
mutate
)

Reverse the items in an array.

public static <T> Iterator<T>

Returns:

a reversed Iterator
reverse
(Iterator<T>
an Iterator
self
)

Reverses the iterator.

public static <K, V> Map<K, V>

Returns:

returns the self parameter
reverseEach
(Map<K, V>
the map over which we iterate
self
,
Closure<V>
the 1 or 2 arg closure applied on each entry of the map
closure
)

Allows a Map to be iterated through in reverse order using a closure.

public static <T> List<T>

Returns:

the original list
reverseEach
(List<T>
a List
self
,
Closure<V>
a closure to which each item is passed.
closure
)

Iterate over each element of the list in the reverse order.

public static <T> T[]

Returns:

the original array
reverseEach
(T[]
an array
self
,
Closure<V>
a closure to which each item is passed
closure
)

Iterate over each element of the array in the reverse order.

public static Number

Returns:

the resulting number
rightShift
(Number
a Number object
self
,
Number
the shift distance by which to right shift the number
operand
)

Implementation of the right shift operator for integral types.

public static Number

Returns:

the resulting number
rightShiftUnsigned
(Number
a Number object
self
,
Number
the shift distance by which to right shift (unsigned) the number
operand
)

Implementation of the right shift (unsigned) operator for integral types.

public static int

Returns:

the rounded value of that Float
round
(Float
a Float
number
)

Round the value

public static float

Returns:

the Float rounded to the number of decimal places specified by precision
round
(Float
a Float
number
,
int
the number of decimal places to keep
precision
)

Round the value

public static long

Returns:

the rounded value of that Double
round
(Double
a Double
number
)

Round the value

public static double

Returns:

the Double rounded to the number of decimal places specified by precision
round
(Double
a Double
number
,
int
the number of decimal places to keep
precision
)

Round the value

public static BigDecimal

Returns:

the rounded value of that BigDecimal
round
(BigDecimal
a BigDecimal
number
)

Round the value

Note that this method differs from java.math.BigDecimal#round(java.math.MathContext) which specifies the digits to retain starting from the leftmost nonzero digit.

public static BigDecimal

Returns:

a BigDecimal rounded to the number of decimal places specified by precision
round
(BigDecimal
a BigDecimal
number
,
int
the number of decimal places to keep
precision
)

Round the value

Note that this method differs from java.math.BigDecimal#round(java.math.MathContext) which specifies the digits to retain starting from the leftmost nonzero digit.

public static TimerTask

Returns:

The timer task which has been scheduled.
runAfter
(Timer
a timer object
timer
,
int
the delay in milliseconds before running the closure code
delay
,
final Closure<V>
the closure to invoke
closure
)

Allows a simple syntax for using timers.

public static void
setMetaClass(Class<T>
the class whose metaclass we wish to set
self
,
MetaClass
the new MetaClass
metaClass
)

Sets the metaclass for a given class.

public static void
setMetaClass(Object
the object whose metaclass we want to set
self
,
MetaClass
the new metaclass value
metaClass
)

Set the metaclass for an object.

public static void
setMetaClass(GroovyObject
the object whose metaclass we want to set
self
,
MetaClass
the new metaclass value
metaClass
)

Set the metaclass for a GroovyObject.

public static void
shuffle(List<?>
a List
self
)

Randomly reorders the elements of the specified list.

public static void
shuffle(List<?>
a List
self
,
Random rnd)

Randomly reorders the elements of the specified list using the specified random instance as the source of randomness.

public static <T> void
shuffle(T[]
an array
self
)

Randomly reorders the elements of the specified array.

public static <T> void
shuffle(T[]
an array
self
,
Random rnd)

Randomly reorders the elements of the specified array using the specified random instance as the source of randomness.

public static <T> List<T>
shuffled(List<T>
a List
self
)

Creates a new list containing the elements of the specified list but in a random order.

public static <T> List<T>
shuffled(List<T>
a List
self
,
Random rnd)

Creates a new list containing the elements of the specified list but in a random order using the specified random instance as the source of randomness.

public static <T> T[]

Returns:

the shuffled array
shuffled
(T[]
an array
self
)

Creates a new array containing the elements of the specified array but in a random order.

public static <T> T[]

Returns:

the shuffled array
shuffled
(T[]
an array
self
,
Random rnd)

Creates a new array containing the elements of the specified array but in a random order using the specified random instance as the source of randomness.

public static int

Returns:

the length of the Iterator
size
(Iterator<E>
an Iterator
self
)

Provide the standard Groovy size() method for Iterator.

public static int

Returns:

the length of the Iterable
size
(Iterable<T>
an Iterable
self
)

Provide the standard Groovy size() method for Iterable.

public static int

Returns:

the size (length) of the Array
size
(Object[]
an Array of objects
self
)

Provide the standard Groovy size() method for an array.

public static int

Returns:

the length of the array
size
(boolean[]
a boolean array
array
)

Allows arrays to behave similar to collections.

public static int

Returns:

the length of the array
size
(byte[]
a byte array
array
)

Allows arrays to behave similar to collections.

public static int

Returns:

the length of the array
size
(char[]
a char array
array
)

Allows arrays to behave similar to collections.

public static int

Returns:

the length of the array
size
(short[]
a short array
array
)

Allows arrays to behave similar to collections.

public static int

Returns:

the length of the array
size
(int[]
an int array
array
)

Allows arrays to behave similar to collections.

public static int

Returns:

the length of the array
size
(long[]
a long array
array
)

Allows arrays to behave similar to collections.

public static int

Returns:

the length of the array
size
(float[]
a float array
array
)

Allows arrays to behave similar to collections.

public static int

Returns:

the length of the array
size
(double[]
a double array
array
)

Allows arrays to behave similar to collections.

public static <T> List<T>

Returns:

the sorted Iterable as a List
sort
(Iterable<T>
the Iterable to be sorted
self
)

Sorts the Collection.

public static <T> List<T>

Returns:

the sorted iterable as a List
sort
(Iterable<T>
the iterable to be sorted
self
,
boolean
false will always cause a new list to be created, true will mutate lists in place
mutate
)

Sorts the Iterable.

public static <K, V> Map<K, V>

Returns:

the sorted map
sort
(Map<K, V>
the original unsorted map
self
,
Closure<V>
a Closure used as a comparator
closure
)

Sorts the elements from the given map into a new ordered map using the closure as a comparator to determine the ordering.

public static <K, V> Map<K, V>

Returns:

the sorted map
sort
(Map<K, V>
the original unsorted map
self
,
Comparator<? super K>
a Comparator
comparator
)

Sorts the elements from the given map into a new ordered Map using the specified key comparator to determine the ordering.

public static <K, V> Map<K, V>

Returns:

the sorted map
sort
(Map<K, V>
the original unsorted map
self
)

Sorts the elements from the given map into a new ordered Map using the natural ordering of the keys to determine the ordering.

public static <T> T[]

Returns:

the sorted array
sort
(T[]
the array to be sorted
self
)

Modifies this array so that its elements are in sorted order.

public static <T> T[]

Returns:

the sorted array
sort
(T[]
the array to be sorted
self
,
boolean
false will always cause a new array to be created, true will mutate the array in place
mutate
)

Sorts the given array into sorted order.

public static <T> Iterator<T>

Returns:

the sorted items as an Iterator
sort
(Iterator<T>
the Iterator to be sorted
self
)

Sorts the given iterator items into a sorted iterator.

public static <T> Iterator<T>

Returns:

the sorted items as an Iterator
sort
(Iterator<T>
the Iterator to be sorted
self
,
Comparator<? super T>
a Comparator used for comparing items
comparator
)

Sorts the given iterator items into a sorted iterator using the comparator.

public static <T> List<T>

Returns:

a sorted List
sort
(Iterable<T>
the Iterable to be sorted
self
,
boolean
false will always cause a new list to be created, true will mutate lists in place
mutate
,
Comparator<? super T>
a Comparator used for the comparison
comparator
)

Sorts the Iterable using the given Comparator.

public static <T> T[]

Returns:

the sorted array
sort
(T[]
the array to be sorted
self
,
Comparator<? super T>
a Comparator used for the comparison
comparator
)

Sorts the given array into sorted order using the given comparator.

public static <T> T[]

Returns:

a sorted array
sort
(T[]
the array containing elements to be sorted
self
,
boolean
false will always cause a new array to be created, true will mutate arrays in place
mutate
,
Comparator<? super T>
a Comparator used for the comparison
comparator
)

Modifies this array so that its elements are in sorted order as determined by the given comparator.

public static <T> Iterator<T>

Returns:

the sorted items as an Iterator
sort
(Iterator<T>
the Iterator to be sorted
self
,
Closure<V>
a Closure used to determine the correct ordering
closure
)

Sorts the given iterator items into a sorted iterator using the Closure to determine the correct ordering.

public static <T> T[]

Returns:

the sorted array
sort
(T[]
the array containing the elements to be sorted
self
,
Closure<V>
a Closure used to determine the correct ordering
closure
)

Sorts the elements from this array into a newly created array using the Closure to determine the correct ordering.

public static <T> T[]

Returns:

the sorted array
sort
(T[]
the array to be sorted
self
,
boolean
false will always cause a new array to be created, true will mutate arrays in place
mutate
,
Closure<V>
a Closure used to determine the correct ordering
closure
)

Modifies this array so that its elements are in sorted order using the Closure to determine the correct ordering.

public static <T> List<T>

Returns:

a newly created sorted List
sort
(Iterable<T>
the Iterable to be sorted
self
,
Closure<V>
a 1 or 2 arg Closure used to determine the correct ordering
closure
)

Sorts this Iterable using the given Closure to determine the correct ordering.

public static <T> List<T>

Returns:

a newly created sorted List
sort
(Iterable<T>
the Iterable to be sorted
self
,
boolean
false will always cause a new list to be created, true will mutate lists in place
mutate
,
Closure<V>
a 1 or 2 arg Closure used to determine the correct ordering
closure
)

Sorts this Iterable using the given Closure to determine the correct ordering.

public static <T> SortedSet<T>

Returns:

the set
sort
(SortedSet<T>
an already sorted set
self
)

Avoids doing unnecessary work when sorting an already sorted set (i.e. an identity function for an already sorted set).

public static <K, V> SortedMap<K, V>

Returns:

the map
sort
(SortedMap<K, V>
an already sorted map
self
)

Avoids doing unnecessary work when sorting an already sorted map (i.e. an identity function for an already sorted map).

public static Collection<E>

Returns:

a List whose first item is the accepted values and whose second item is the rejected values
split
(Object
an Object with an Iterator returning its values
self
,
Closure<V>
a closure condition
closure
)

Splits all items into two lists based on the closure condition.

public static <T> Collection<Collection<T>>

Returns:

a List whose first item is the accepted values and whose second item is the rejected values
split
(Collection<T>
a Collection of values
self
,
Closure<V>
a closure condition
closure
)

Splits all items into two collections based on the closure condition.

public static <T> Collection<Collection<T>>

Returns:

a List whose first item is the accepted values and whose second item is the rejected values
split
(T[]
an Array
self
,
Closure<V>
a closure condition
closure
)

Splits all items into two collections based on the closure condition.

private static <T> Collection<Collection<T>>
split(Closure<V> closure, Collection<T> accept, Collection<T> reject, Iterator<T> iter)

public static <T> List<List<T>>

Returns:

a List whose first item is the accepted values and whose second item is the rejected values
split
(List<T>
a List of values
self
,
Closure<V>
a closure condition
closure
)

Splits all items into two collections based on the closure condition.

public static <T> List<Set<T>>

Returns:

a List whose first item is the accepted values and whose second item is the rejected values
split
(Set<T>
a Set of values
self
,
Closure<V>
a closure condition
closure
)

Splits all items into two collections based on the closure condition.

public static SpreadMap

Returns:

a newly created SpreadMap
spread
(Map<K, V>
a map
self
)

Synonym for toSpreadMap(java.util.Map).

public static String

Returns:

the resulting formatted string
sprintf
(Object
any Object
self
,
String
a format string
format
,
Object[]
values referenced by the format specifiers in the format string
values
)

Sprintf to a string.

public static String

Returns:

the resulting printf'd string
sprintf
(Object
any Object
self
,
String
A format string
format
,
Object
Argument which is referenced by the format specifiers in the format string. The type of arg should be one of Object[], List, int[], short[], byte[], char[], boolean[], long[], float[], or double[].
arg
)

Returns a formatted string using the specified format string and arguments.

public static void
step(Number
a Number to start with
self
,
Number
a Number to go up to, exclusive
to
,
Number
a Number representing the step increment
stepNumber
,
Closure<V>
the closure to call
closure
)

Iterates from this number up to the given number using a step increment.

public static <K, V> Map<K, V>

Returns:

a new Map containing the given keys
subMap
(Map<K, V>
a Map
map
,
Collection<K>
a Collection of keys
keys
)

Creates a sub-Map containing the given keys.

public static <K, V> Map<K, V>

Returns:

a new Map containing the given keys
subMap
(Map<K, V>
a Map
map
,
K[]
an array of keys
keys
)

Creates a sub-Map containing the given keys.

public static <T> Set<List<T>>

Returns:

the subsequences from the list
subsequences
(List<T>
the List of items
self
)

Finds all non-null subsequences of a list.

public static Object
sum(Collection<E> self)

Deprecated Use the Iterable version of sum instead
public static Object

Returns:

The sum of all of the items
sum
(Iterable<?>
Iterable of values to add together
self
)

Sums the items in an Iterable.

public static Object

Returns:

The sum of all of the items
sum
(Object[]
The array of values to add together
self
)

Sums the items in an array.

public static Object

Returns:

The sum of all of the items
sum
(Iterator<Object>
an Iterator for the values to add together
self
)

Sums the items from an Iterator.

public static byte

Returns:

The sum of all of the items
sum
(byte[]
The array of values to add together
self
)

Sums the items in an array.

public static short

Returns:

The sum of all of the items
sum
(short[]
The array of values to add together
self
)

Sums the items in an array.

public static int

Returns:

The sum of all of the items
sum
(int[]
The array of values to add together
self
)

Sums the items in an array.

public static long

Returns:

The sum of all of the items
sum
(long[]
The array of values to add together
self
)

Sums the items in an array.

public static char

Returns:

The sum of all of the items
sum
(char[]
The array of values to add together
self
)

Sums the items in an array.

public static float

Returns:

The sum of all of the items
sum
(float[]
The array of values to add together
self
)

Sums the items in an array.

public static double

Returns:

The sum of all of the items
sum
(double[]
The array of values to add together
self
)

Sums the items in an array.

public static Object
sum(Collection<E> self, Object initialValue)

Deprecated Use the Iterable version of sum instead
public static Object

Returns:

The sum of all of the items.
sum
(Iterable<?>
an Iterable of values to sum
self
,
Object
the items in the collection will be summed to this initial value
initialValue
)

Sums the items in an Iterable, adding the result to some initial value.

public static Object

Returns:

The sum of all of the items.
sum
(Object[]
an array of values to sum
self
,
Object
the items in the array will be summed to this initial value
initialValue
)

Sums the items in an array, adding the result to some initial value.

public static Object

Returns:

The sum of all of the items
sum
(Iterator<?>
an Iterator for the values to add together
self
,
Object
the items in the collection will be summed to this initial value
initialValue
)

Sums the items from an Iterator, adding the result to some initial value.

private static Object
sum(Iterator<?> self, Object initialValue, boolean first)

public static byte

Returns:

The sum of all of the items.
sum
(byte[]
an array of values to sum
self
,
byte
the items in the array will be summed to this initial value
initialValue
)

Sums the items in an array, adding the result to some initial value.

public static short

Returns:

The sum of all of the items.
sum
(short[]
an array of values to sum
self
,
short
the items in the array will be summed to this initial value
initialValue
)

Sums the items in an array, adding the result to some initial value.

public static int

Returns:

The sum of all of the items.
sum
(int[]
an array of values to sum
self
,
int
the items in the array will be summed to this initial value
initialValue
)

Sums the items in an array, adding the result to some initial value.

public static long

Returns:

The sum of all of the items.
sum
(long[]
an array of values to sum
self
,
long
the items in the array will be summed to this initial value
initialValue
)

Sums the items in an array, adding the result to some initial value.

public static char

Returns:

The sum of all of the items.
sum
(char[]
an array of values to sum
self
,
char
the items in the array will be summed to this initial value
initialValue
)

Sums the items in an array, adding the result to some initial value.

public static float

Returns:

The sum of all of the items.
sum
(float[]
an array of values to sum
self
,
float
the items in the array will be summed to this initial value
initialValue
)

Sums the items in an array, adding the result to some initial value.

public static double

Returns:

The sum of all of the items.
sum
(double[]
an array of values to sum
self
,
double
the items in the array will be summed to this initial value
initialValue
)

Sums the items in an array, adding the result to some initial value.

public static Object
sum(Collection<E> self, Closure<V> closure)

Deprecated Use the Iterable version of sum instead
public static <T> Object

Returns:

The sum of the values returned by applying the closure to each item of the Iterable.
sum
(Iterable<T>
an Iterable
self
,
Closure<V>
a single parameter closure that returns a (typically) numeric value.
closure
)

Sums the result of applying a closure to each item of an Iterable.

public static <T> Object

Returns:

The sum of the values returned by applying the closure to each item of the array.
sum
(T[]
An array
self
,
Closure<V>
a single parameter closure that returns a (typically) numeric value.
closure
)

Sums the result of applying a closure to each item of an array.

public static <T> Object

Returns:

The sum of the values returned by applying the closure to each item from the Iterator.
sum
(Iterator<T>
An Iterator
self
,
Closure<V>
a single parameter closure that returns a (typically) numeric value.
closure
)

Sums the result of applying a closure to each item returned from an iterator.

public static Object
sum(Collection<E> self, Object initialValue, Closure<V> closure)

Deprecated Use the Iterable version of sum instead
public static <T> Object

Returns:

The sum of the values returned by applying the closure to each item of the collection.
sum
(Iterable<T>
an Iterable
self
,
Object
the closure results will be summed to this initial value
initialValue
,
Closure<V>
a single parameter closure that returns a (typically) numeric value.
closure
)

Sums the result of applying a closure to each item of an Iterable to some initial value.

public static <T> Object

Returns:

The sum of the values returned by applying the closure to each item of the array.
sum
(T[]
an array
self
,
Object
the closure results will be summed to this initial value
initialValue
,
Closure<V>
a single parameter closure that returns a (typically) numeric value.
closure
)

Sums the result of applying a closure to each item of an array to some initial value.

public static <T> Object

Returns:

The sum of the values returned by applying the closure to each item from the Iterator.
sum
(Iterator<T>
an Iterator
self
,
Object
the closure results will be summed to this initial value
initialValue
,
Closure<V>
a single parameter closure that returns a (typically) numeric value.
closure
)

Sums the result of applying a closure to each item of an Iterator to some initial value.

private static Object
sum(Iterator<?> self, Object initialValue, Closure<V> closure, boolean first)

public static <T> List<T>

Returns:

self
swap
(List<T>
a List
self
,
int
a position
i
,
int
a position
j
)

Swaps two elements at the specified positions.

public static <T> T[]

Returns:

self
swap
(T[]
an array
self
,
int
a position
i
,
int
a position
j
)

Swaps two elements at the specified positions.

public static boolean[]

Returns:

self
swap
(boolean[]
a boolean array
self
,
int
a position
i
,
int
a position
j
)

Swaps two elements at the specified positions.

public static byte[]

Returns:

self
swap
(byte[]
a boolean array
self
,
int
a position
i
,
int
a position
j
)

Swaps two elements at the specified positions.

public static char[]

Returns:

self
swap
(char[]
a boolean array
self
,
int
a position
i
,
int
a position
j
)

Swaps two elements at the specified positions.

public static double[]

Returns:

self
swap
(double[]
a boolean array
self
,
int
a position
i
,
int
a position
j
)

Swaps two elements at the specified positions.

public static float[]

Returns:

self
swap
(float[]
a boolean array
self
,
int
a position
i
,
int
a position
j
)

Swaps two elements at the specified positions.

public static int[]

Returns:

self
swap
(int[]
a boolean array
self
,
int
a position
i
,
int
a position
j
)

Swaps two elements at the specified positions.

public static long[]

Returns:

self
swap
(long[]
a boolean array
self
,
int
a position
i
,
int
a position
j
)

Swaps two elements at the specified positions.

public static short[]

Returns:

self
swap
(short[]
a boolean array
self
,
int
a position
i
,
int
a position
j
)

Swaps two elements at the specified positions.

public static <T> List<T>

Returns:

a List without its first element
tail
(List<T>
a List
self
)

Returns the items from the List excluding the first item.

public static <T> SortedSet<T>

Returns:

a SortedSet without its first element
tail
(SortedSet<T>
a SortedSet
self
)

Returns the items from the SortedSet excluding the first item.

public static <T> Collection<T>

Returns:

a collection without its first element
tail
(Iterable<T>
an Iterable
self
)

Returns the items from the Iterable excluding the first item.

public static <T> T[]

Returns:

an array without its first element
tail
(T[]
an array
self
)

Returns the items from the array excluding the first item.

public static <T> Iterator<T>

Returns:

the iterator without its first element
tail
(Iterator<T>
the original iterator
self
)

Returns the original iterator after throwing away the first element.

public static <T> List<List<T>>

Returns:

a List of the tail values from the given Iterable
tails
(Iterable<T>
an Iterable
self
)

Calculates the tail values of this Iterable: the first value will be this list of all items from the iterable and the final one will be an empty list, with the intervening values the results of successive applications of tail on the items.

public static <T> List<T>

Returns:

a List consisting of the first num elements from this List, or else all the elements from the List if it has less then num elements.
take
(List<T>
the original List
self
,
int
the number of elements to take from this List
num
)

Returns the first num elements from the head of this List.

public static <T> SortedSet<T>

Returns:

a SortedSet consisting of the first num elements from this List, or else all the elements from the SortedSet if it has less then num elements.
take
(SortedSet<T>
the original SortedSet
self
,
int
the number of elements to take from this SortedSet
num
)

Returns the first num elements from the head of this SortedSet.

public static <T> T[]

Returns:

an array consisting of the first num elements of this array, or else the whole array if it has less then num elements.
take
(T[]
the original array
self
,
int
the number of elements to take from this array
num
)

Returns the first num elements from the head of this array.

public static <T> Collection<T>

Returns:

a Collection consisting of the first num elements from this Iterable, or else all the elements from the Iterable if it has less then num elements.
take
(Iterable<T>
the original Iterable
self
,
int
the number of elements to take from this Iterable
num
)

Returns the first num elements from the head of this Iterable.

public static <K, V> Map<K, V>

Returns:

a new map consisting of the first num elements of this map, or else the whole map if it has less then num elements.
take
(Map<K, V>
the original map
self
,
int
the number of elements to take from this map
num
)

Returns a new map containing the first num elements from the head of this map.

public static <T> Iterator<T>

Returns:

an iterator consisting of up to the first num elements of this iterator.
take
(Iterator<T>
the Iterator
self
,
int
the number of elements to take from this iterator
num
)

Returns an iterator of up to the first num elements from this iterator.

public static <T> T[]

Returns:

an array consisting of the last num elements of this array, or else the whole array if it has less then num elements.
takeRight
(T[]
the original array
self
,
int
the number of elements to take from this array
num
)

Returns the last num elements from the tail of this array.

public static <T> Collection<T>

Returns:

a Collection consisting of the last num elements from this Iterable, or else all the elements from the Iterable if it has less then num elements.
takeRight
(Iterable<T>
the original Iterable
self
,
int
the number of elements to take from this Iterable
num
)

Returns the last num elements from the tail of this Iterable.

public static <T> List<T>

Returns:

a List consisting of the last num elements from this List, or else all the elements from the List if it has less then num elements.
takeRight
(List<T>
the original List
self
,
int
the number of elements to take from this List
num
)

Returns the last num elements from the tail of this List.

public static <T> SortedSet<T>

Returns:

a SortedSet consisting of the last num elements from this SortedSet, or else all the elements from the SortedSet if it has less then num elements.
takeRight
(SortedSet<T>
the original SortedSet
self
,
int
the number of elements to take from this SortedSet
num
)

Returns the last num elements from the tail of this SortedSet.

public static <T> List<T>

Returns:

a prefix of the given list where each element passed to the given closure evaluates to true
takeWhile
(List<T>
the original list
self
,
Closure<V>
the closure that must evaluate to true to continue taking elements
condition
)

Returns the longest prefix of this list where each element passed to the given closure condition evaluates to true.

public static <T> Collection<T>

Returns:

a Collection containing a prefix of the elements from the given Iterable where each element passed to the given closure evaluates to true
takeWhile
(Iterable<T>
an Iterable
self
,
Closure<V>
the closure that must evaluate to true to continue taking elements
condition
)

Returns a Collection containing the longest prefix of the elements from this Iterable where each element passed to the given closure evaluates to true.

public static <T> SortedSet<T>

Returns:

a prefix of the given SortedSet where each element passed to the given closure evaluates to true
takeWhile
(SortedSet<T>
the original SortedSet
self
,
Closure<V>
the closure that must evaluate to true to continue taking elements
condition
)

Returns the longest prefix of this SortedSet where each element passed to the given closure condition evaluates to true.

public static <K, V> Map<K, V>

Returns:

a prefix of the given Map where each entry (or key/value pair) passed to the given closure evaluates to true
takeWhile
(Map<K, V>
a Map
self
,
Closure<V>
a 1 (or 2) arg Closure that must evaluate to true for the entry (or key and value) to continue taking elements
condition
)

Returns the longest prefix of this Map where each entry (or key/value pair) when passed to the given closure evaluates to true.

public static <T> T[]

Returns:

a prefix of the given array where each element passed to the given closure evaluates to true
takeWhile
(T[]
the original array
self
,
Closure<V>
the closure that must evaluate to true to continue taking elements
condition
)

Returns the longest prefix of this array where each element passed to the given closure evaluates to true.

public static <T> Iterator<T>

Returns:

a prefix of elements in the given iterator where each element passed to the given closure evaluates to true
takeWhile
(Iterator<T>
the Iterator
self
,
Closure<V>
the closure that must evaluate to true to continue taking elements
condition
)

Returns the longest prefix of elements in this iterator where each element passed to the given condition closure evaluates to true.

public static <T, U> U

Returns:

self
tap
(U
the object to have a closure act upon
self
,
Closure<T>
the closure to call on the object
closure
)

Allows the closure to be called for the object reference self (similar to with and always returns self.

public static void
times(Number
a Number
self
,
Closure<V>
the closure to call a number of times
closure
)

Executes the closure this many times, starting from zero.

public static String

Returns:

the string representation
toArrayString
(Object[]
an Object[]
self
)

Returns the string representation of the given array.

public static BigDecimal

Returns:

a BigDecimal
toBigDecimal
(Number
a Number
self
)

Transform a Number into a BigDecimal

public static BigInteger

Returns:

a BigInteger
toBigInteger
(Number
a Number
self
)

Transform this Number into a BigInteger.

public static Boolean

Returns:

the original Boolean
toBoolean
(Boolean
a Boolean
self
)

Identity conversion which returns Boolean.TRUE for a true Boolean and Boolean.FALSE for a false Boolean.

public static Double

Returns:

a Double
toDouble
(Number
a Number
self
)

Transform a Number into a Double

public static Float

Returns:

a Float
toFloat
(Number
a Number
self
)

Transform a Number into a Float

public static Integer

Returns:

an Integer
toInteger
(Number
a Number
self
)

Transform a Number into an Integer

public static <T> List<T>
toList(Collection<T> self)

Deprecated Use the Iterable version of toList instead
public static <T> List<T>

Returns:

a List
toList
(Iterator<T>
an iterator
self
)

Convert an iterator to a List.

public static <T> List<T>

Returns:

a List
toList
(Iterable<T>
an Iterable
self
)

Convert an Iterable to a List.

public static <T> List<T>

Returns:

a List
toList
(Enumeration<T>
an enumeration
self
)

Convert an enumeration to a List.

public static <T> List<T>

Returns:

the array as a List
toList
(T[]
an Array of Objects
array
)

Allows conversion of arrays into a mutable List.

public static List<Byte>

Returns:

a list containing the contents of this array.
toList
(byte[]
a byte array
array
)

Converts this array to a List of the same size, with each element added to the list.

public static List<Boolean>

Returns:

a list containing the contents of this array.
toList
(boolean[]
a boolean array
array
)

Converts this array to a List of the same size, with each element added to the list.

public static List<Character>

Returns:

a list containing the contents of this array.
toList
(char[]
a char array
array
)

Converts this array to a List of the same size, with each element added to the list.

public static List<Short>

Returns:

a list containing the contents of this array.
toList
(short[]
a short array
array
)

Converts this array to a List of the same size, with each element added to the list.

public static List<Integer>

Returns:

a list containing the contents of this array.
toList
(int[]
an int array
array
)

Converts this array to a List of the same size, with each element added to the list.

public static List<Long>

Returns:

a list containing the contents of this array.
toList
(long[]
a long array
array
)

Converts this array to a List of the same size, with each element added to the list.

public static List<Float>

Returns:

a list containing the contents of this array.
toList
(float[]
a float array
array
)

Converts this array to a List of the same size, with each element added to the list.

public static List<Double>

Returns:

a list containing the contents of this array.
toList
(double[]
a double array
array
)

Converts this array to a List of the same size, with each element added to the list.

public static String

Returns:

the string representation
toListString
(Collection<E>
a Collection
self
)

Returns the string representation of the given list.

public static String

Returns:

the string representation
toListString
(Collection<E>
a Collection
self
,
int
stop after approximately this many characters and append '...'
maxSize
)

Returns the string representation of the given list.

public static Long

Returns:

a Long
toLong
(Number
a Number
self
)

Transform a Number into a Long

public static char

Returns:

the lowercase equivalent of the character, if any; otherwise, the character itself.
toLowerCase
(Character
a Character to convert
self
)

Converts the character to lowercase.

public static String

Returns:

the string representation
toMapString
(Map<K, V>
a Map
self
)

Returns the string representation of this map.

public static String

Returns:

the string representation
toMapString
(Map<K, V>
a Map
self
,
int
stop after approximately this many characters and append '...'
maxSize
)

Returns the string representation of this map.

public static Set<Byte>

Returns:

a set containing the unique contents of this array.
toSet
(byte[]
a byte array
array
)

Converts this array to a Set, with each unique element added to the set.

public static Set<Boolean>

Returns:

a set containing the unique contents of this array.
toSet
(boolean[]
a boolean array
array
)

Converts this array to a Set, with each unique element added to the set.

public static Set<Character>

Returns:

a set containing the unique contents of this array.
toSet
(char[]
a char array
array
)

Converts this array to a Set, with each unique element added to the set.

public static Set<Short>

Returns:

a set containing the unique contents of this array.
toSet
(short[]
a short array
array
)

Converts this array to a Set, with each unique element added to the set.

public static Set<Integer>

Returns:

a set containing the unique contents of this array.
toSet
(int[]
an int array
array
)

Converts this array to a Set, with each unique element added to the set.

public static Set<Long>

Returns:

a set containing the unique contents of this array.
toSet
(long[]
a long array
array
)

Converts this array to a Set, with each unique element added to the set.

public static Set<Float>

Returns:

a set containing the unique contents of this array.
toSet
(float[]
a float array
array
)

Converts this array to a Set, with each unique element added to the set.

public static Set<Double>

Returns:

a set containing the unique contents of this array.
toSet
(double[]
a double array
array
)

Converts this array to a Set, with each unique element added to the set.

public static <T> Set<T>

Returns:

a Set
toSet
(Collection<T>
a collection
self
)

Convert a Collection to a Set.

public static <T> Set<T>

Returns:

a Set
toSet
(Iterable<T>
an Iterable
self
)

Convert an Iterable to a Set.

public static <T> Set<T>

Returns:

a Set
toSet
(Iterator<T>
an iterator
self
)

Convert an iterator to a Set.

public static <T> Set<T>

Returns:

a Set
toSet
(Enumeration<T>
an enumeration
self
)

Convert an enumeration to a Set.

public static <T> List<T>

Returns:

the sorted iterable as a List
toSorted
(Iterable<T>
the Iterable to be sorted
self
)

Sorts the Iterable.

public static <T> List<T>

Returns:

a sorted List
toSorted
(Iterable<T>
the Iterable to be sorted
self
,
Comparator<T>
a Comparator used for the comparison
comparator
)

Sorts the Iterable using the given Comparator.

public static <T> List<T>

Returns:

a newly created sorted List
toSorted
(Iterable<T>
the Iterable to be sorted
self
,
Closure<V>
a 1 or 2 arg Closure used to determine the correct ordering
closure
)

Sorts this Iterable using the given Closure to determine the correct ordering.

public static <T> Iterator<T>

Returns:

the sorted items as an Iterator
toSorted
(Iterator<T>
the Iterator to be sorted
self
)

Sorts the Iterator.

public static <T> Iterator<T>

Returns:

the sorted items as an Iterator
toSorted
(Iterator<T>
the Iterator to be sorted
self
,
Comparator<T>
a Comparator used for comparing items
comparator
)

Sorts the given iterator items using the comparator.

public static <T> Iterator<T>

Returns:

the sorted items as an Iterator
toSorted
(Iterator<T>
the Iterator to be sorted
self
,
Closure<V>
a Closure used to determine the correct ordering
closure
)

Sorts the given iterator items into a sorted iterator using the Closure to determine the correct ordering.

public static <T> T[]

Returns:

the sorted array
toSorted
(T[]
the array to be sorted
self
)

Returns a sorted version of the given array using the supplied comparator.

public static <T> T[]

Returns:

the sorted array
toSorted
(T[]
the array to be sorted
self
,
Comparator<T>
a Comparator used for the comparison
comparator
)

Returns a sorted version of the given array using the supplied comparator to determine the resulting order.

public static <T> T[]

Returns:

a sorted array
toSorted
(T[]
the array containing the elements to be sorted
self
,
Closure<V>
a Closure used to determine the correct ordering
condition
)

Sorts the elements from this array into a newly created array using the Closure to determine the correct ordering.

public static <K, V> Map<K, V>

Returns:

the sorted map
toSorted
(Map<K, V>
the original unsorted map
self
)

Sorts the elements from the given map into a new ordered map using a NumberAwareComparator on map entry values to determine the resulting order.

public static <K, V> Map<K, V>

Returns:

the sorted map
toSorted
(Map<K, V>
the original unsorted map
self
,
Comparator<Map.Entry<K, V>>
a Comparator used for the comparison
comparator
)

Sorts the elements from the given map into a new ordered map using the supplied comparator to determine the ordering.

public static <K, V> Map<K, V>

Returns:

the sorted map
toSorted
(Map<K, V>
the original unsorted map
self
,
Closure<V>
a Closure used as a comparator
condition
)

Sorts the elements from the given map into a new ordered map using the supplied Closure condition as a comparator to determine the ordering.

public static <T> Set<T>

Returns:

an ordered copy of the sorted set
toSorted
(SortedSet<T>
an already sorted set
self
)

Avoids doing unnecessary work when sorting an already sorted set

public static <K, V> Map<K, V>

Returns:

an ordered copy of the map
toSorted
(SortedMap<K, V>
an already sorted map
self
)

Avoids doing unnecessary work when sorting an already sorted map

public static SpreadMap

Returns:

a newly created SpreadMap if this map is not null and its size is positive.
toSpreadMap
(Map<K, V>
a map to be converted into a SpreadMap
self
)

Returns a new SpreadMap from this map.

public static SpreadMap

Returns:

a newly created SpreadMap
toSpreadMap
(Object[]
an object array
self
)

Creates a spreadable map from this array.

public static SpreadMap

Returns:

a newly created SpreadMap
toSpreadMap
(List<E>
a list
self
)

Creates a spreadable map from this list.

public static SpreadMap

Returns:

a newly created SpreadMap
toSpreadMap
(Iterable<T>
an iterable
self
)

Creates a spreadable map from this iterable.

public static String

Returns:

the string representation
toString
(boolean[]
an array
self
)

Returns the string representation of the given array.

public static String

Returns:

the string representation
toString
(byte[]
an array
self
)

Returns the string representation of the given array.

public static String

Returns:

the string representation
toString
(char[]
an array
self
)

Returns the string representation of the given array.

public static String

Returns:

the string representation
toString
(short[]
an array
self
)

Returns the string representation of the given array.

public static String

Returns:

the string representation
toString
(int[]
an array
self
)

Returns the string representation of the given array.

public static String

Returns:

the string representation
toString
(long[]
an array
self
)

Returns the string representation of the given array.

public static String

Returns:

the string representation
toString
(float[]
an array
self
)

Returns the string representation of the given array.

public static String

Returns:

the string representation
toString
(double[]
an array
self
)

Returns the string representation of the given array.

public static String

Returns:

the string representation
toString
(AbstractMap<K, V>
a Map
self
)

Returns the string representation of the given map.

public static String

Returns:

the string representation
toString
(AbstractCollection<E>
a Collection
self
)

Returns the string representation of the given collection.

public static String

Returns:

the string representation
toString
(Object[]
an Object[]
self
)

Returns the string representation of this array's contents.

public static String

Returns:

a string.
toString
(Object
an object
value
)

Create a String representation of this object.

public static <T> Iterator<T>

Returns:

an Iterator with no duplicate items
toUnique
(Iterator<T>
an Iterator
self
,
Closure<V>
a Closure used to determine unique items
condition
)

Returns an iterator equivalent to this iterator but with all duplicated items removed where duplicate (equal) items are deduced by calling the supplied Closure condition.

public static <T> Iterator<T>

Returns:

an Iterator with no duplicate items
toUnique
(Iterator<T>
an Iterator
self
,
Comparator<T>
a Comparator used to determine unique (equal) items If null, the Comparable natural ordering of the elements will be used.
comparator
)

Returns an iterator equivalent to this iterator with all duplicated items removed by using the supplied comparator.

public static <T> Iterator<T>

Returns:

an Iterator with no duplicate items
toUnique
(Iterator<T>
an Iterator
self
)

Returns an iterator equivalent to this iterator with all duplicated items removed by using the natural ordering of the items.

public static <T> Collection<T>

Returns:

the Collection of non-duplicate items
toUnique
(Iterable<T>
an Iterable
self
,
Comparator<T>
a Comparator used to determine unique (equal) items If null, the Comparable natural ordering of the elements will be used.
comparator
)

Returns a Collection containing the items from the Iterable but with duplicates removed.

public static <T> List<T>

Returns:

the List of non-duplicate items
toUnique
(List<T>
a List
self
,
Comparator<T>
a Comparator used to determine unique (equal) items If null, the Comparable natural ordering of the elements will be used.
comparator
)

Returns a List containing the items from the List but with duplicates removed.

public static <T> Collection<T>

Returns:

the Collection of non-duplicate items
toUnique
(Iterable<T>
an Iterable
self
)

Returns a Collection containing the items from the Iterable but with duplicates removed using the natural ordering of the items to determine uniqueness.

public static <T> List<T>

Returns:

the List of non-duplicate items
toUnique
(List<T>
a List
self
)

Returns a List containing the items from the List but with duplicates removed using the natural ordering of the items to determine uniqueness.

public static <T> Collection<T>

Returns:

a new Collection
toUnique
(Iterable<T>
an Iterable
self
,
Closure<V>
a Closure used to determine unique items
condition
)

Returns a Collection containing the items from the Iterable but with duplicates removed.

public static <T> List<T>

Returns:

a new List
toUnique
(List<T>
a List
self
,
Closure<V>
a Closure used to determine unique items
condition
)

Returns a List containing the items from the List but with duplicates removed.

public static <T> T[]

Returns:

the unique items from the array
toUnique
(T[]
an array
self
,
Comparator<T>
a Comparator used to determine unique (equal) items If null, the Comparable natural ordering of the elements will be used.
comparator
)

Returns a new Array containing the items from the original Array but with duplicates removed with the supplied comparator determining which items are unique.

public static <T> T[]

Returns:

the unique items from the array
toUnique
(T[]
an array
self
)

Returns a new Array containing the items from the original Array but with duplicates removed using the natural ordering of the items in the array.

public static <T> T[]

Returns:

the unique items from the array
toUnique
(T[]
an array
self
,
Closure<V>
a Closure used to determine unique items
condition
)

Returns a new Array containing the items from the original Array but with duplicates removed with the supplied comparator determining which items are unique.

public static char

Returns:

the uppercase equivalent of the character, if any; otherwise, the character itself.
toUpperCase
(Character
a Character to convert
self
)

Converts the character to uppercase.

public static List<E>

Returns:

a List of the transposed lists
transpose
(List<E>
a List of lists
self
)

Adds GroovyCollections#transpose(List) as a method on lists.

public static int[][]

Returns:

the transposed 2D int array
transpose
(int[][]
a 2D int array
self
)

A transpose method for 2D int arrays.

public static long[][]

Returns:

the transposed 2D long array
transpose
(long[][]
a 2D long array
self
)

A transpose method for 2D long arrays.

public static double[][]

Returns:

the transposed 2D double array
transpose
(double[][]
a 2D double array
self
)

A transpose method for 2D double arrays.

public static float

Returns:

the Float truncated to the number of decimal places specified by precision
trunc
(Float
a Float
number
,
int
the number of decimal places to keep
precision
)

Truncate the value

public static float

Returns:

the Float truncated to 0 decimal places
trunc
(Float
a Float
number
)

Truncate the value

public static double

Returns:

the Double truncated to 0 decimal places
trunc
(Double
a Double
number
)

Truncate the value

public static double

Returns:

the Double truncated to the number of decimal places specified by precision
trunc
(Double
a Double
number
,
int
the number of decimal places to keep
precision
)

Truncate the value

public static BigDecimal

Returns:

a BigDecimal truncated to 0 decimal places
trunc
(BigDecimal
a BigDecimal
number
)

Truncate the value

public static BigDecimal

Returns:

a BigDecimal truncated to the number of decimal places specified by precision
trunc
(BigDecimal
a BigDecimal
number
,
int
the number of decimal places to keep
precision
)

Truncate the value

public static Number

Returns:

the negation of the number
unaryMinus
(Number
a Number
left
)

Negates the number.

public static Number

Returns:

the number
unaryPlus
(Number
a Number
left
)

Returns the number, effectively being a noop for numbers.

public static <T> Iterator<T>

Returns:

a new Iterator of the unique items from the original iterator
unique
(Iterator<T>
an Iterator
self
)

Returns an iterator equivalent to this iterator with all duplicated items removed by using Groovy's default number-aware comparator.

public static <T> Collection<T>

Returns:

the now modified collection
unique
(Collection<T>
a collection
self
)

Modifies this collection to remove all duplicated items, using Groovy's default number-aware comparator.

public static <T> List<T>

Returns:

the now modified List
unique
(List<T>
a List
self
)

Modifies this List to remove all duplicated items, using Groovy's default number-aware comparator.

public static <T> Collection<T>

Returns:

the now modified collection
unique
(Collection<T>
a collection
self
,
boolean
false will cause a new list containing unique items from the collection to be created, true will mutate collections in place
mutate
)

Remove all duplicates from a given Collection using Groovy's default number-aware comparator.

public static <T> List<T>

Returns:

the now modified List
unique
(List<T>
a List
self
,
boolean
false will cause a new List containing unique items from the List to be created, true will mutate List in place
mutate
)

Remove all duplicates from a given List using Groovy's default number-aware comparator.

public static <T> Iterator<T>

Returns:

the modified Iterator
unique
(Iterator<T>
an Iterator
self
,
Closure<V>
a Closure used to determine unique items
condition
)

Returns an iterator equivalent to this iterator but with all duplicated items removed by using a Closure to determine duplicate (equal) items.

public static <T> Collection<T>

Returns:

self without any duplicates
unique
(Collection<T>
a Collection
self
,
Closure<V>
a 1 or 2 arg Closure used to determine unique items
closure
)

A convenience method for making a collection unique using a Closure to determine duplicate (equal) items.

public static <T> List<T>

Returns:

self without any duplicates
unique
(List<T>
a List
self
,
Closure<V>
a 1 or 2 arg Closure used to determine unique items
closure
)

A convenience method for making a List unique using a Closure to determine duplicate (equal) items.

public static <T> Collection<T>

Returns:

self without any duplicates
unique
(Collection<T>
a Collection
self
,
boolean
false will always cause a new list to be created, true will mutate lists in place
mutate
,
Closure<V>
a 1 or 2 arg Closure used to determine unique items
closure
)

A convenience method for making a collection unique using a Closure to determine duplicate (equal) items.

public static <T> List<T>

Returns:

self without any duplicates
unique
(List<T>
a List
self
,
boolean
false will always cause a new list to be created, true will mutate lists in place
mutate
,
Closure<V>
a 1 or 2 arg Closure used to determine unique items
closure
)

A convenience method for making a List unique using a Closure to determine duplicate (equal) items.

public static <T> Iterator<T>

Returns:

the modified Iterator
unique
(Iterator<T>
an Iterator
self
,
Comparator<T>
a Comparator
comparator
)

Returns an iterator equivalent to this iterator with all duplicated items removed by using the supplied comparator.

public static <T> Collection<T>

Returns:

self the now modified collection without duplicates
unique
(Collection<T>
a Collection
self
,
Comparator<T>
a Comparator
comparator
)

Remove all duplicates from a given Collection.

public static <T> List<T>

Returns:

self the now modified List without duplicates
unique
(List<T>
a List
self
,
Comparator<T>
a Comparator
comparator
)

Remove all duplicates from a given List.

public static <T> Collection<T>

Returns:

self the collection without duplicates
unique
(Collection<T>
a Collection
self
,
boolean
false will always cause a new collection to be created, true will mutate collections in place
mutate
,
Comparator<T>
a Comparator
comparator
)

Remove all duplicates from a given Collection.

public static <T> List<T>

Returns:

self the List without duplicates
unique
(List<T>
a List
self
,
boolean
false will always cause a new List to be created, true will mutate List in place
mutate
,
Comparator<T>
a Comparator
comparator
)

Remove all duplicates from a given List.

private static <T> List<T>
private static <T> List<T>
uniqueItems(Iterable<T> self, Comparator<T> comparator)

public static void
upto(Number
a Number
self
,
Number
another Number to go up to
to
,
Closure<V>
the closure to call
closure
)

Iterates from this number up to the given number, inclusive, incrementing by one each time.

public static void
upto(long
a long
self
,
Number
the end number
to
,
Closure<V>
the code to execute for each number
closure
)

Iterates from this number up to the given number, inclusive, incrementing by one each time.

public static void
upto(Long
a Long
self
,
Number
the end number
to
,
Closure<V>
the code to execute for each number
closure
)

Iterates from this number up to the given number, inclusive, incrementing by one each time.

public static void
upto(float
a float
self
,
Number
the end number
to
,
Closure<V>
the code to execute for each number
closure
)

Iterates from this number up to the given number, inclusive, incrementing by one each time.

public static void
upto(Float
a Float
self
,
Number
the end number
to
,
Closure<V>
the code to execute for each number
closure
)

Iterates from this number up to the given number, inclusive, incrementing by one each time.

public static void
upto(double
a double
self
,
Number
the end number
to
,
Closure<V>
the code to execute for each number
closure
)

Iterates from this number up to the given number, inclusive, incrementing by one each time.

public static void
upto(Double
a Double
self
,
Number
the end number
to
,
Closure<V>
the code to execute for each number
closure
)

Iterates from this number up to the given number, inclusive, incrementing by one each time.

public static void
upto(BigInteger
a BigInteger
self
,
Number
the end number
to
,
Closure<V>
the code to execute for each number
closure
)

Iterates from this number up to the given number, inclusive, incrementing by one each time.

public static void
upto(BigDecimal
a BigDecimal
self
,
Number
the end number
to
,
Closure<V>
the code to execute for each number
closure
)

Iterates from this number up to the given number, inclusive, incrementing by one each time.

public static <T> T

Returns:

the value returned from the closure
use
(Object
any Object
self
,
Class<T>
a category class to use
categoryClass
,
Closure<T>
the closure to invoke with the category in place
closure
)

Scoped use method

public static <T> T

Returns:

the value returned from the closure
use
(Object
any Object
self
,
List<Class<T>>
a list of category classes
categoryClassList
,
Closure<T>
the closure to invoke with the categories in place
closure
)

Scoped use method with list of categories.

public static Object

Returns:

the value returned from the closure
use
(Object
any Object
self
,
Object[]
a list of category classes and a Closure
array
)

Allows you to use a list of categories, specifying the list as varargs.

public static <T, U> T

Returns:

result of calling the closure
with
(U
the object to have a closure act upon
self
,
Closure<T>
the closure to call on the object
closure
)

Allows the closure to be called for the object reference self.

public static <T, U extends T, V extends T> T

Returns:

the self object or the result of calling the closure depending on 'returning'
with
(U
the object to have a closure act upon
self
,
boolean
if true, return the self object; otherwise, the result of calling the closure
returning
,
Closure<T>
the closure to call on the object
closure
)

Allows the closure to be called for the object reference self.

public static <K, V> Map<K, V>

Returns:

the wrapped Map
withDefault
(Map<K, V>
a Map
self
,
Closure<V>
a Closure which is passed the unknown key
init
)

Wraps a map using the decorator pattern with a wrapper that intercepts all calls to get(key).

public static <T> ListWithDefault<T>

Returns:

the decorated List
withDefault
(List<T>
a List
self
,
Closure<T>
a Closure with the target index as parameter which generates the default value
init
)

An alias for withLazyDefault which decorates a list allowing it to grow when called with index values outside the normal list bounds.

public static <T> List<T>
withDefault$$bridge(List<T> self, Closure<T> init)

Deprecated
public static <T> ListWithDefault<T>

Returns:

the wrapped List
withEagerDefault
(List<T>
a List
self
,
Closure<T>
a Closure with the target index as parameter which generates the default value
init
)

Decorates a list allowing it to grow when called with a non-existent index value.

public static <T> List<T>
withEagerDefault$$bridge(List<T> self, Closure<T> init)

Deprecated
public static <E> List<Tuple2<E, Integer>>

Returns:

a zipped list with indices
withIndex
(Iterable<E>
an Iterable
self
)

Zips an Iterable with indices in (value, index) order.

public static <E> List<Tuple2<E, Integer>>

Returns:

a zipped list with indices
withIndex
(Iterable<E>
an Iterable
self
,
int
an index to start from
offset
)

Zips an Iterable with indices in (value, index) order.

public static <E> Iterator<Tuple2<E, Integer>>

Returns:

a zipped iterator with indices
withIndex
(Iterator<E>
an iterator
self
)

Zips an iterator with indices in (value, index) order.

public static <E> Iterator<Tuple2<E, Integer>>

Returns:

a zipped iterator with indices
withIndex
(Iterator<E>
an iterator
self
,
int
an index to start from
offset
)

Zips an iterator with indices in (value, index) order.

public static <T> ListWithDefault<T>

Returns:

the decorated List
withLazyDefault
(List<T>
a List
self
,
Closure<T>
a Closure with the target index as parameter which generates the default value
init
)

Decorates a list allowing it to grow when called with a non-existent index value.

public static <T> List<T>
withLazyDefault$$bridge(List<T> self, Closure<T> init)

Deprecated
public static Object

Returns:

a proxy implementing the trait interfaces
withTraits
(Object
object to be wrapped
self
,
Class<?>...
a list of trait classes
traits
)

Dynamically wraps an instance into something which implements the supplied trait classes.

public static BitSet

Returns:

the bitwise XOR of both BitSets
xor
(BitSet
a BitSet
left
,
BitSet
another BitSet to bitwise XOR
right
)

Bitwise XOR together two BitSets.

public static Number

Returns:

the bitwise XOR of both Numbers
xor
(Number
a Number
left
,
Number
another Number to bitwse XOR
right
)

Bitwise XOR together two Numbers.

public static Boolean

Returns:

result of exclusive disjunction
xor
(Boolean
left operator
left
,
Boolean
right operator
right
)

Exclusive disjunction of two boolean operators

Inherited from org.codehaus.groovy.runtime.DefaultGroovyMethodsSupport:
cloneSimilarCollectioncloneSimilarMapcloseQuietlycloseWithWarningcreateSimilarArraycreateSimilarCollectioncreateSimilarCollectioncreateSimilarCollectioncreateSimilarListcreateSimilarMapcreateSimilarOrDefaultCollectioncreateSimilarQueuecreateSimilarSetnormaliseIndexsameTypesubListBorderssubListBorderstryClosewriteUTF16BomIfRequiredwriteUTF16BomIfRequiredwriteUTF16BomIfRequiredwriteUTF16BomIfRequired