Package org.codehaus.groovy.runtime
Class DefaultGroovyMethods
- java.lang.Object
-
- org.codehaus.groovy.runtime.DefaultGroovyMethodsSupport
-
- org.codehaus.groovy.runtime.DefaultGroovyMethods
-
public class DefaultGroovyMethods extends DefaultGroovyMethodsSupport
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 areverse()
method forString
.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.
-
-
Field Summary
Fields Modifier and Type Field Description static Class[]
ADDITIONAL_CLASSES
static Class[]
DGM_LIKE_CLASSES
-
Constructor Summary
Constructors Constructor Description DefaultGroovyMethods()
-
Method Summary
All Methods Static Methods Concrete Methods Deprecated Methods Modifier and Type Method Description static double
abs(Double number)
Get the absolute valuestatic float
abs(Float number)
Get the absolute valuestatic long
abs(Long number)
Get the absolute valuestatic int
abs(Number number)
Get the absolute valuestatic Socket
accept(ServerSocket serverSocket, boolean runInANewThread, Closure closure)
Deprecated.static Socket
accept(ServerSocket serverSocket, Closure closure)
Deprecated.static <T> boolean
addAll(Collection<T> self, Iterable<? extends T> items)
Adds all items from the iterable to the Collection.static <T> boolean
addAll(Collection<T> self, Iterator<? extends T> items)
Adds all items from the iterator to the Collection.static <T> boolean
addAll(Collection<T> self, T[] items)
Modifies the collection by adding all of the elements in the specified array to the collection.static <T> boolean
addAll(List<T> self, int index, T[] items)
Modifies this list by inserting all of the elements in the specified array into the list at the specified position.static void
addShutdownHook(Object self, Closure closure)
Allows the usage of addShutdownHook without getting the runtime first.static Boolean
and(Boolean left, Boolean right)
Logical conjunction of two boolean operators.static Number
and(Number left, Number right)
Bitwise AND together two Numbers.static BitSet
and(BitSet left, BitSet right)
Bitwise AND together two BitSets.static <T> boolean
any(Iterable<T> self, Closure predicate)
Iterates over the contents of an iterable, and checks whether a predicate is valid for at least one element.static boolean
any(Object self)
Iterates over the elements of a collection, and checks whether at least one element is true according to the Groovy Truth.static boolean
any(Object self, Closure predicate)
Iterates over the contents of an object or collection, and checks whether a predicate is valid for at least one element.static <T> boolean
any(Iterator<T> self, Closure predicate)
Iterates over the contents of an iterator, and checks whether a predicate is valid for at least one element.static <K,V>
booleanany(Map<K,V> self, Closure<?> predicate)
Iterates over the entries of a map, and checks whether a predicate is valid for at least one entry.static <T> boolean
any(T[] self, Closure predicate)
Iterates over the contents of an Array, and checks whether a predicate is valid for at least one element.static void
append(File file, byte[] bytes)
Deprecated.static void
append(File self, InputStream stream)
Deprecated.static void
append(File file, Object text)
Deprecated.static void
append(File file, Object text, String charset)
Deprecated.static boolean
asBoolean(boolean[] array)
Coerces a boolean array to a boolean value.static boolean
asBoolean(byte[] array)
Coerces a byte array to a boolean value.static boolean
asBoolean(char[] array)
Coerces a char array to a boolean value.static boolean
asBoolean(double[] array)
Coerces a double array to a boolean value.static boolean
asBoolean(float[] array)
Coerces a float array to a boolean value.static boolean
asBoolean(int[] array)
Coerces an int array to a boolean value.static boolean
asBoolean(long[] array)
Coerces a long array to a boolean value.static boolean
asBoolean(short[] array)
Coerces a short array to a boolean value.static boolean
asBoolean(Boolean bool)
Coerce a Boolean instance to a boolean value.static boolean
asBoolean(Character character)
Coerce a character to a boolean value.static boolean
asBoolean(CharSequence string)
Deprecated.static boolean
asBoolean(Number number)
Coerce a number to a boolean value.static boolean
asBoolean(Object object)
Coerce an object instance to a boolean value.static boolean
asBoolean(Object[] array)
Coerce an Object array to a boolean value.static boolean
asBoolean(Collection collection)
Coerce a collection instance to a boolean value.static boolean
asBoolean(Enumeration enumeration)
Coerce an enumeration instance to a boolean value.static boolean
asBoolean(Iterator iterator)
Coerce an iterator instance to a boolean value.static boolean
asBoolean(Map map)
Coerce a map instance to a boolean value.static boolean
asBoolean(Matcher matcher)
Deprecated.static <T> Collection<T>
asCollection(Iterable<T> self)
Converts this Iterable to a Collection.static <T> Collection<T>
asImmutable(Collection<T> self)
A convenience method for creating an immutable Collection.static <T> List<T>
asImmutable(List<T> self)
A convenience method for creating an immutable List.static <K,V>
Map<K,V>asImmutable(Map<K,V> self)
A convenience method for creating an immutable Map.static <T> Set<T>
asImmutable(Set<T> self)
A convenience method for creating an immutable Set.static <K,V>
SortedMap<K,V>asImmutable(SortedMap<K,V> self)
A convenience method for creating an immutable SortedMap.static <T> SortedSet<T>
asImmutable(SortedSet<T> self)
A convenience method for creating an immutable SortedSet.static <T> List<T>
asList(Iterable<T> self)
Converts this Iterable to a List.static <T> List<T>
asList(Collection<T> self)
Deprecated.Use the Iterable version of asList insteadstatic String
asString(Throwable self)
Get the detail information ofThrowable
instance's stack tracestatic <T> Collection<T>
asSynchronized(Collection<T> self)
A convenience method for creating a synchronized Collection.static <T> List<T>
asSynchronized(List<T> self)
A convenience method for creating a synchronized List.static <K,V>
Map<K,V>asSynchronized(Map<K,V> self)
A convenience method for creating a synchronized Map.static <T> Set<T>
asSynchronized(Set<T> self)
A convenience method for creating a synchronized Set.static <K,V>
SortedMap<K,V>asSynchronized(SortedMap<K,V> self)
A convenience method for creating a synchronized SortedMap.static <T> SortedSet<T>
asSynchronized(SortedSet<T> self)
A convenience method for creating a synchronized SortedSet.static <T> T
asType(Closure cl, Class<T> clazz)
Coerces the closure to an implementation of the given class.static <T> T
asType(GString self, Class<T> c)
Deprecated.static <T> T
asType(File f, Class<T> c)
Deprecated.static <T> T
asType(CharSequence self, Class<T> c)
Deprecated.static <T> T
asType(Iterable iterable, Class<T> clazz)
Converts the given iterable to another type.static <T> T
asType(Number self, Class<T> c)
Transform this number to a the given type, using the 'as' operator.static <T> T
asType(Object[] ary, Class<T> clazz)
Converts the given array to either a List, Set, or SortedSet.static <T> T
asType(Object obj, Class<T> type)
Converts a given object to a type.static <T> T
asType(String self, Class<T> c)
Deprecated.static <T> T
asType(Collection col, Class<T> clazz)
Converts the given collection to another type.static <T> T
asType(Map map, Class<T> clazz)
Coerces this map to the given type, using the map's keys as the public method names, and values as the implementation.static <T> Collection<T>
asUnmodifiable(Collection<T> self)
Creates an unmodifiable view of a Collection.static <T> List<T>
asUnmodifiable(List<T> self)
Creates an unmodifiable view of a List.static <K,V>
Map<K,V>asUnmodifiable(Map<K,V> self)
Creates an unmodifiable view of a Map.static <T> Set<T>
asUnmodifiable(Set<T> self)
Creates an unmodifiable view of a Set.static <K,V>
SortedMap<K,V>asUnmodifiable(SortedMap<K,V> self)
Creates an unmodifiable view of a SortedMap.static <T> SortedSet<T>
asUnmodifiable(SortedSet<T> self)
Creates an unmodifiable view of a SortedSet.static File
asWritable(File file)
Deprecated.static File
asWritable(File file, String encoding)
Deprecated.static Pattern
bitwiseNegate(CharSequence self)
Deprecated.static Number
bitwiseNegate(Number left)
Bitwise NEGATE a Number.static Pattern
bitwiseNegate(String self)
Deprecated.static BitSet
bitwiseNegate(BitSet self)
Bitwise NEGATE a BitSet.static <T> BufferedIterator<T>
buffered(Iterator<T> self)
Returns aBufferedIterator
that allows examining the next element without consuming it.static <T> BufferedIterator<T>
bufferedIterator(Iterable<T> self)
Returns aBufferedIterator
that allows examining the next element without consuming it.static <T> BufferedIterator<T>
bufferedIterator(List<T> self)
Returns aBufferedIterator
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>
TcallClosureForMapEntry(Closure<T> closure, Map.Entry<K,V> entry)
protected static <T,K,V>
TcallClosureForMapEntryAndCounter(Closure<T> closure, Map.Entry<K,V> entry, int counter)
static CharSequence
capitalize(CharSequence self)
Deprecated.static String
capitalize(String self)
Deprecated.static CharSequence
center(CharSequence self, Number numberOfChars)
Deprecated.static CharSequence
center(CharSequence self, Number numberOfChars, CharSequence padding)
Deprecated.static String
center(String self, Number numberOfChars)
Deprecated.static String
center(String self, Number numberOfChars, String padding)
Deprecated.static <T> List<List<T>>
chop(Iterable<T> self, int... chopSizes)
Chops the Iterable into pieces, returning lists with sizes corresponding to the supplied chop sizes.static <T> List<List<T>>
chop(Iterator<T> self, int... chopSizes)
Chops the iterator items into pieces, returning lists with sizes corresponding to the supplied chop sizes.static <T> List<List<T>>
chop(T[] self, int... chopSizes)
Chops the array into pieces, returning lists with sizes corresponding to the supplied chop sizes.static <T> List<List<T>>
collate(Iterable<T> self, int size)
Collates this iterable into sub-lists of lengthsize
.static <T> List<List<T>>
collate(Iterable<T> self, int size, boolean keepRemainder)
Collates this iterable into sub-lists of lengthsize
.static <T> List<List<T>>
collate(Iterable<T> self, int size, int step)
Collates this iterable into sub-lists of lengthsize
stepping through the codestep
elements for each subList.static <T> List<List<T>>
collate(Iterable<T> self, int size, int step, boolean keepRemainder)
Collates this iterable into sub-lists of lengthsize
stepping through the codestep
elements for each sub-list.static <T> List<List<T>>
collate(List<T> self, int size)
Deprecated.use the Iterable variant insteadstatic <T> List<List<T>>
collate(List<T> self, int size, boolean keepRemainder)
Deprecated.use the Iterable variant insteadstatic <T> List<List<T>>
collate(List<T> self, int size, int step)
Deprecated.use the Iterable variant insteadstatic <T> List<List<T>>
collate(List<T> self, int size, int step, boolean keepRemainder)
Deprecated.use the Iterable variant insteadstatic <T> List<List<T>>
collate(T[] self, int size)
Collates an array.static <T> List<List<T>>
collate(T[] self, int size, boolean keepRemainder)
Collates this array into sub-lists.static <T> List<List<T>>
collate(T[] self, int size, int step)
Collates an array into sub-lists.static <T> List<List<T>>
collate(T[] self, int size, int step, boolean keepRemainder)
Collates this array into into sub-lists.static <S,T>
List<T>collect(Iterable<S> self, Closure<T> transform)
Iterates through this Iterable transforming each entry into a new value using thetransform
closure returning a list of transformed values.static <S,T>
Collection<T>collect(Iterable<S> self, Collection<T> collector, Closure<? extends T> transform)
Iterates through this collection transforming each value into a new value using thetransform
closure and adding it to the suppliedcollector
.static <T> List<T>
collect(Iterable<T> 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.static Collection
collect(Object 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.static <T> List<T>
collect(Object self, Closure<T> transform)
Iterates through this aggregate Object transforming each item into a new value using thetransform
closure, returning a list of transformed values.static <T> Collection<T>
collect(Object self, Collection<T> collector, Closure<? extends T> transform)
Iterates through this aggregate Object transforming each item into a new value using thetransform
closure and adding it to the suppliedcollector
.static <S,T>
List<T>collect(Collection<S> self, Closure<T> transform)
Deprecated.use the Iterable version insteadstatic <S,T>
Collection<T>collect(Collection<S> self, Collection<T> collector, Closure<? extends T> transform)
Deprecated.use the Iterable version insteadstatic <T> List<T>
collect(Collection<T> self)
Deprecated.use the Iterable version insteadstatic <S,T>
List<T>collect(Iterator<S> self, Closure<T> transform)
Iterates through this Iterator transforming each item into a new value using thetransform
closure, returning a list of transformed values.static <S,T>
Collection<T>collect(Iterator<S> self, Collection<T> collector, Closure<? extends T> transform)
Iterates through this Iterator transforming each item into a new value using thetransform
closure and adding it to the suppliedcollector
.static <T,K,V>
List<T>collect(Map<K,V> self, Closure<T> transform)
Iterates through this Map transforming each map entry into a new value using thetransform
closure returning a list of transformed values.static <T,K,V>
Collection<T>collect(Map<K,V> self, Collection<T> collector, Closure<? extends T> transform)
Iterates through this Map transforming each map entry into a new value using thetransform
closure returning thecollector
with all transformed values added to it.static <S,T>
List<T>collect(S[] self, Closure<T> transform)
Iterates through this Array transforming each item into a new value using thetransform
closure, returning a list of transformed values.static <S,T>
Collection<T>collect(S[] self, Collection<T> collector, Closure<? extends T> transform)
Iterates through this Array transforming each item into a new value using thetransform
closure and adding it to the suppliedcollector
.static List
collectAll(Collection self, Closure transform)
Deprecated.Use collectNested insteadstatic Collection
collectAll(Collection self, Collection collector, Closure transform)
Deprecated.Use collectNested insteadstatic <K,V,E>
Map<K,V>collectEntries(E[] self)
A variant of collectEntries using the identity closure as the transform.static <K,V,E>
Map<K,V>collectEntries(E[] self, Closure<?> transform)
Iterates through this array transforming each item using thetransform
closure and returning a map of the resulting transformed entries.static <K,V,E>
Map<K,V>collectEntries(E[] self, Map<K,V> collector)
A variant of collectEntries using the identity closure as the transform.static <K,V,E>
Map<K,V>collectEntries(E[] self, Map<K,V> collector, Closure<?> transform)
Iterates through this array transforming each item using thetransform
closure and returning a map of the resulting transformed entries.static <K,V>
Map<K,V>collectEntries(Iterable<?> self)
A variant of collectEntries for Iterable objects using the identity closure as the transform.static <K,V>
Map<K,V>collectEntries(Iterable<?> self, Map<K,V> collector)
A variant of collectEntries for Iterables using the identity closure as the transform and a supplied map as the destination of transformed entries.static <K,V,E>
Map<K,V>collectEntries(Iterable<E> self, Closure<?> transform)
Iterates through this Iterable transforming each item using thetransform
closure and returning a map of the resulting transformed entries.static <K,V,E>
Map<K,V>collectEntries(Iterable<E> self, Map<K,V> collector, Closure<?> 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.static <K,V>
Map<K,V>collectEntries(Collection<?> self)
Deprecated.Use the Iterable version of collectEntries insteadstatic <K,V>
Map<K,V>collectEntries(Collection<?> self, Closure<?> transform)
Deprecated.Use the Iterable version of collectEntries insteadstatic <K,V>
Map<K,V>collectEntries(Collection<?> self, Map<K,V> collector)
Deprecated.Use the Iterable version of collectEntries insteadstatic <K,V>
Map<K,V>collectEntries(Collection<?> self, Map<K,V> collector, Closure<?> transform)
Deprecated.Use the Iterable version of collectEntries insteadstatic <K,V>
Map<K,V>collectEntries(Iterator<?> self)
A variant of collectEntries for Iterators using the identity closure as the transform.static <K,V>
Map<K,V>collectEntries(Iterator<?> self, Map<K,V> collector)
A variant of collectEntries for Iterators using the identity closure as the transform and a supplied map as the destination of transformed entries.static <K,V,E>
Map<K,V>collectEntries(Iterator<E> self, Closure<?> transform)
A variant of collectEntries for Iterators.static <K,V,E>
Map<K,V>collectEntries(Iterator<E> self, Map<K,V> collector, Closure<?> transform)
A variant of collectEntries for Iterators using a supplied map as the destination of transformed entries.static <K,V>
Map<?,?>collectEntries(Map<K,V> self, Closure<?> transform)
Iterates through this Map transforming each entry using thetransform
closure and returning a map of the transformed entries.static <K,V,S,T>
Map<K,V>collectEntries(Map<S,T> self, Map<K,V> collector, Closure<?> transform)
Iterates through this Map transforming each map entry using thetransform
closure returning a map of the transformed entries.static <T,E>
List<T>collectMany(E[] self, Closure<Collection<? extends T>> projection)
Projects each item from a source array to a collection and concatenates (flattens) the resulting collections into a single list.static <T,E>
List<T>collectMany(Iterable<E> self, Closure<Collection<? extends T>> projection)
Projects each item from a source Iterable to a collection and concatenates (flattens) the resulting collections into a single list.static <T,E>
Collection<T>collectMany(Iterable<E> self, Collection<T> collector, Closure<Collection<? extends T>> projection)
Projects each item from a source collection to a result collection and concatenates (flattens) the resulting collections adding them into thecollector
.static <T,E>
List<T>collectMany(Collection<E> self, Closure<Collection<? extends T>> projection)
Deprecated.Use the Iterable version of collectMany insteadstatic <T,E>
Collection<T>collectMany(Collection<E> self, Collection<T> collector, Closure<Collection<? extends T>> projection)
Deprecated.Use the Iterable version of collectMany insteadstatic <T,E>
List<T>collectMany(Iterator<E> self, Closure<Collection<? extends T>> projection)
Projects each item from a source iterator to a collection and concatenates (flattens) the resulting collections into a single list.static <T,K,V>
Collection<T>collectMany(Map<K,V> self, Closure<Collection<? extends T>> projection)
Projects each item from a source map to a result collection and concatenates (flattens) the resulting collections adding them into a collection.static <T,K,V>
Collection<T>collectMany(Map<K,V> self, Collection<T> collector, Closure<Collection<? extends T>> projection)
Projects each item from a source map to a result collection and concatenates (flattens) the resulting collections adding them into thecollector
.static List
collectNested(Iterable self, Closure transform)
Recursively iterates through this Iterable transforming each non-Collection value into a new value using the closure as a transformer.static Collection
collectNested(Iterable self, Collection collector, Closure transform)
Recursively iterates through this Iterable transforming each non-Collection value into a new value using thetransform
closure.static List
collectNested(Collection self, Closure transform)
Recursively iterates through this collection transforming each non-Collection value into a new value using the closure as a transformer.static Collection
collectNested(Collection self, Collection collector, Closure transform)
Deprecated.Use the Iterable version of collectNested insteadstatic List
combinations(Iterable self)
Adds GroovyCollections#combinations(Iterable) as a method on Iterables.static List
combinations(Iterable self, Closure<?> function)
Adds GroovyCollections#combinations(Iterable, Closure) as a method on collections.static List
combinations(Collection self)
Deprecated.Use the Iterable version of combinations insteadstatic int
compareTo(Character left, Character right)
Compare two Characters.static int
compareTo(Character left, Number right)
Compare a Character and a Number.static int
compareTo(Number left, Character right)
Compare a Number and a Character.static int
compareTo(Number left, Number right)
Compare two Numbers.static boolean
contains(boolean[] self, Object value)
Checks whether the array contains the given value.static boolean
contains(byte[] self, Object value)
Checks whether the array contains the given value.static boolean
contains(char[] self, Object value)
Checks whether the array contains the given value.static boolean
contains(double[] self, Object value)
Checks whether the array contains the given value.static boolean
contains(float[] self, Object value)
Checks whether the array contains the given value.static boolean
contains(int[] self, Object value)
Checks whether the array contains the given value.static boolean
contains(long[] self, Object value)
Checks whether the array contains the given value.static boolean
contains(short[] self, Object value)
Checks whether the array contains the given value.static boolean
contains(CharSequence self, CharSequence text)
Deprecated.static boolean
contains(Iterable self, Object item)
Returns true if this iterable contains the item.static boolean
contains(Object[] self, Object value)
Checks whether the array contains the given value.static boolean
contains(String self, String text)
Deprecated.static boolean
containsAll(Iterable self, Object[] items)
Returns true if this iterable contains all of the elements in the specified array.static boolean
containsAll(Collection self, Object[] items)
Deprecated.use the Iterable variant insteadstatic Number
count(boolean[] self, Object value)
Counts the number of occurrences of the given value inside this array.static Number
count(byte[] self, Object value)
Counts the number of occurrences of the given value inside this array.static Number
count(char[] self, Object value)
Counts the number of occurrences of the given value inside this array.static Number
count(double[] self, Object value)
Counts the number of occurrences of the given value inside this array.static Number
count(float[] self, Object value)
Counts the number of occurrences of the given value inside this array.static Number
count(int[] self, Object value)
Counts the number of occurrences of the given value inside this array.static Number
count(long[] self, Object value)
Counts the number of occurrences of the given value inside this array.static Number
count(short[] self, Object value)
Counts the number of occurrences of the given value inside this array.static int
count(CharSequence self, CharSequence text)
Deprecated.static <T> Number
count(Iterable<T> self, Closure closure)
Counts the number of occurrences which satisfy the given closure from inside this Iterable.static Number
count(Iterable self, Object value)
Counts the number of occurrences of the given value inside this Iterable.static Number
count(Object[] self, Object value)
Counts the number of occurrences of the given value inside this array.static int
count(String self, String text)
Deprecated.static Number
count(Collection self, Closure closure)
Deprecated.use count(Iterable, Closure)static Number
count(Collection self, Object value)
Deprecated.use count(Iterable, Closure)static <T> Number
count(Iterator<T> self, Closure closure)
Counts the number of occurrences which satisfy the given closure from the items within this Iterator.static Number
count(Iterator self, Object value)
Counts the number of occurrences of the given value from the items within this Iterator.static <K,V>
Numbercount(Map<K,V> self, Closure<?> closure)
Counts the number of occurrences which satisfy the given closure from inside this map.static <T> Number
count(T[] self, Closure closure)
Counts the number of occurrences which satisfy the given closure from inside this array.static <K,E>
Map<K,Integer>countBy(E[] self, Closure<K> closure)
Sorts all array members into groups determined by the supplied mapping closure and counts the group size.static <K,E>
Map<K,Integer>countBy(Iterable<E> self, Closure<K> closure)
Sorts all collection members into groups determined by the supplied mapping closure and counts the group size.static <K> Map<K,Integer>
countBy(Collection self, Closure<K> closure)
Deprecated.Use the Iterable version of countBy insteadstatic <K,E>
Map<K,Integer>countBy(Iterator<E> self, Closure<K> closure)
Sorts all iterator items into groups determined by the supplied mapping closure and counts the group size.static <K,U,V>
Map<K,Integer>countBy(Map<U,V> self, Closure<K> closure)
Groups the members of a map into groups determined by the supplied mapping closure and counts the frequency of the created groups.protected static StringBufferWriter
createStringBufferWriter(StringBuffer self)
Deprecated.protected static StringWriter
createStringWriter(String self)
Deprecated.static boolean
deleteDir(File self)
Deprecated.static CharSequence
denormalize(CharSequence self)
Deprecated.static String
denormalize(String self)
Deprecated.static boolean
disjoint(Iterable left, Iterable right)
Returnstrue
if the intersection of two iterables is empty.static boolean
disjoint(Collection left, Collection right)
Deprecated.use the Iterable variant insteadstatic Number
div(Character left, Character right)
Divide one Character by another.static Number
div(Character left, Number right)
Divide a Character by a Number.static Number
div(Number left, Character right)
Divide a Number by a Character.static void
downto(double self, Number to, Closure closure)
Iterates from this number down to the given number, inclusive, decrementing by one each time.static void
downto(float self, Number to, Closure closure)
Iterates from this number down to the given number, inclusive, decrementing by one each time.static void
downto(long self, Number to, Closure closure)
Iterates from this number down to the given number, inclusive, decrementing by one each time.static void
downto(Double self, Number to, Closure closure)
Iterates from this number down to the given number, inclusive, decrementing by one each time.static void
downto(Float self, Number to, Closure closure)
Iterates from this number down to the given number, inclusive, decrementing by one each time.static void
downto(Long self, Number to, Closure closure)
Iterates from this number down to the given number, inclusive, decrementing by one each time.static void
downto(Number self, Number to, Closure closure)
Iterates from this number down to the given number, inclusive, decrementing by one each time.static void
downto(BigDecimal self, Number to, Closure closure)
Iterates from this number down to the given number, inclusive, decrementing by one each time.static void
downto(BigInteger self, Number to, Closure closure)
Iterates from this number down to the given number, inclusive, decrementing by one each time.static CharSequence
drop(CharSequence self, int num)
Deprecated.static <T> Collection<T>
drop(Iterable<T> self, int num)
Drops the given number of elements from the head of this Iterable.static <T> Iterator<T>
drop(Iterator<T> self, int num)
Drops the given number of elements from the head of this iterator if they are available.static <T> List<T>
drop(List<T> self, int num)
Drops the given number of elements from the head of this List.static <K,V>
Map<K,V>drop(Map<K,V> self, int num)
Drops the given number of key/value pairs from the head of this map if they are available.static <T> SortedSet<T>
drop(SortedSet<T> self, int num)
Drops the given number of elements from the head of this List.static <T> T[]
drop(T[] self, int num)
Drops the given number of elements from the head of this array if they are available.static <T> Collection<T>
dropRight(Iterable<T> self, int num)
Drops the given number of elements from the tail of this Iterable.static <T> Iterator<T>
dropRight(Iterator<T> self, int num)
Drops the given number of elements from the tail of this Iterator.static <T> List<T>
dropRight(List<T> self, int num)
Drops the given number of elements from the tail of this List.static <T> SortedSet<T>
dropRight(SortedSet<T> self, int num)
Drops the given number of elements from the tail of this SortedSet.static <T> T[]
dropRight(T[] self, int num)
Drops the given number of elements from the tail of this array if they are available.static <T> Collection<T>
dropWhile(Iterable<T> self, Closure condition)
Returns a suffix of this Iterable where elements are dropped from the front while the given closure evaluates to true.static <T> Iterator<T>
dropWhile(Iterator<T> self, Closure<?> condition)
Creates an Iterator that returns a suffix of the elements from an original Iterator.static <T> List<T>
dropWhile(List<T> self, Closure condition)
Returns a suffix of this List where elements are dropped from the front while the given Closure evaluates to true.static <K,V>
Map<K,V>dropWhile(Map<K,V> self, Closure 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).static <T> SortedSet<T>
dropWhile(SortedSet<T> self, Closure condition)
Returns a suffix of this SortedSet where elements are dropped from the front while the given Closure evaluates to true.static <T> T[]
dropWhile(T[] self, Closure<?> 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.static String
dump(Object self)
Generates a detailed dump string of an object showing its class, hashCode and fields.static <T> Iterable<T>
each(Iterable<T> self, Closure closure)
Iterates through an Iterable, passing each item to the given closure.static <T> Collection<T>
each(Collection<T> self, Closure closure)
Iterates through a Collection, passing each item to the given closure.static <T> Iterator<T>
each(Iterator<T> self, Closure closure)
Iterates through an Iterator, passing each item to the given closure.static <T> List<T>
each(List<T> self, Closure closure)
Iterates through a List, passing each item to the given closure.static <K,V>
Map<K,V>each(Map<K,V> self, Closure closure)
Allows a Map to be iterated through using a closure.static <T> Set<T>
each(Set<T> self, Closure closure)
Iterates through a Set, passing each item to the given closure.static <T> SortedSet<T>
each(SortedSet<T> self, Closure closure)
Iterates through a SortedSet, passing each item to the given closure.static <T> T[]
each(T[] self, Closure closure)
Iterates through an array passing each array entry to the given closure.static <T> T
each(T self, Closure closure)
Iterates through an aggregate type or data structure, passing each item to the given closure.static void
eachByte(byte[] self, Closure closure)
Traverse through each byte of this byte array.static void
eachByte(File self, int bufferLen, Closure closure)
Deprecated.static void
eachByte(File self, Closure closure)
Deprecated.static void
eachByte(InputStream is, int bufferLen, Closure closure)
Deprecated.static void
eachByte(InputStream is, Closure closure)
Deprecated.static void
eachByte(Byte[] self, Closure closure)
Traverse through each byte of this Byte array.static void
eachByte(URL url, int bufferLen, Closure closure)
Deprecated.static void
eachByte(URL url, Closure closure)
Deprecated.static void
eachCombination(Iterable self, Closure<?> function)
Applies a function on each combination of the input lists.static void
eachDir(File self, Closure closure)
Deprecated.static void
eachDirMatch(File self, Object nameFilter, Closure closure)
Deprecated.static void
eachDirRecurse(File self, Closure closure)
Deprecated.static void
eachFile(File self, FileType fileType, Closure closure)
Deprecated.static void
eachFile(File self, Closure closure)
Deprecated.static void
eachFileMatch(File self, FileType fileType, Object nameFilter, Closure closure)
Deprecated.static void
eachFileMatch(File self, Object nameFilter, Closure closure)
Deprecated.static void
eachFileRecurse(File self, FileType fileType, Closure closure)
Deprecated.static void
eachFileRecurse(File self, Closure closure)
Deprecated.static <T> T
eachLine(File self, int firstLine, Closure<T> closure)
Deprecated.static <T> T
eachLine(File self, Closure<T> closure)
Deprecated.static <T> T
eachLine(File self, String charset, int firstLine, Closure<T> closure)
Deprecated.static <T> T
eachLine(File self, String charset, Closure<T> closure)
Deprecated.static <T> T
eachLine(InputStream stream, int firstLine, Closure<T> closure)
Deprecated.static <T> T
eachLine(InputStream stream, Closure<T> closure)
Deprecated.static <T> T
eachLine(InputStream stream, String charset, int firstLine, Closure<T> closure)
Deprecated.static <T> T
eachLine(InputStream stream, String charset, Closure<T> closure)
Deprecated.static <T> T
eachLine(Reader self, int firstLine, Closure<T> closure)
Deprecated.static <T> T
eachLine(Reader self, Closure<T> closure)
Deprecated.static <T> T
eachLine(CharSequence self, int firstLine, Closure<T> closure)
Deprecated.static <T> T
eachLine(CharSequence self, Closure<T> closure)
Deprecated.static <T> T
eachLine(String self, int firstLine, Closure<T> closure)
Deprecated.static <T> T
eachLine(String self, Closure<T> closure)
Deprecated.static <T> T
eachLine(URL url, int firstLine, Closure<T> closure)
Deprecated.static <T> T
eachLine(URL url, Closure<T> closure)
Deprecated.static <T> T
eachLine(URL url, String charset, int firstLine, Closure<T> closure)
Deprecated.static <T> T
eachLine(URL url, String charset, Closure<T> closure)
Deprecated.static String
eachMatch(CharSequence self, CharSequence regex, Closure closure)
Deprecated.static String
eachMatch(CharSequence self, Pattern pattern, Closure closure)
Deprecated.static String
eachMatch(String self, String regex, Closure closure)
Deprecated.static String
eachMatch(String self, Pattern pattern, Closure closure)
Deprecated.static void
eachObject(File self, Closure closure)
Deprecated.static void
eachObject(ObjectInputStream ois, Closure closure)
Deprecated.static <T> Iterator<List<T>>
eachPermutation(Iterable<T> self, Closure closure)
Iterates over all permutations of a collection, running a closure for each iteration.static <T> Iterator<List<T>>
eachPermutation(Collection<T> self, Closure closure)
Deprecated.Use the Iterable version of eachPermutation insteadstatic <T> Iterable<T>
eachWithIndex(Iterable<T> self, Closure closure)
Iterates through an iterable type, passing each item and the item's index (a counter starting at zero) to the given closure.static <T> Collection<T>
eachWithIndex(Collection<T> self, Closure closure)
Iterates through a Collection, passing each item and the item's index (a counter starting at zero) to the given closure.static <T> Iterator<T>
eachWithIndex(Iterator<T> self, Closure closure)
Iterates through an iterator type, passing each item and the item's index (a counter starting at zero) to the given closure.static <T> List<T>
eachWithIndex(List<T> self, Closure closure)
Iterates through a List, passing each item and the item's index (a counter starting at zero) to the given closure.static <K,V>
Map<K,V>eachWithIndex(Map<K,V> self, Closure closure)
Allows a Map to be iterated through using a closure.static <T> Set<T>
eachWithIndex(Set<T> self, Closure closure)
Iterates through a Set, passing each item and the item's index (a counter starting at zero) to the given closure.static <T> SortedSet<T>
eachWithIndex(SortedSet<T> self, Closure closure)
Iterates through a SortedSet, passing each item and the item's index (a counter starting at zero) to the given closure.static <T> T[]
eachWithIndex(T[] self, Closure closure)
Iterates through an array, passing each array element and the element's index (a counter starting at zero) to the given closure.static <T> T
eachWithIndex(T self, Closure 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.static boolean
equals(int[] left, int[] right)
Compare the contents of this array to the contents of the given array.static boolean
equals(Object[] left, List right)
Determines if the contents of this array are equal to the contents of the given list, in the same order.static boolean
equals(List left, Object[] right)
Determines if the contents of this list are equal to the contents of the given array in the same order.static boolean
equals(List left, List right)
Compare the contents of two Lists.static boolean
equals(Map self, Map other)
Compares two Maps treating coerced numerical values as identical.static <T> boolean
equals(Set<T> self, Set<T> other)
Compare the contents of two Sets for equality using Groovy's coercion rules.static <T> boolean
every(Iterable<T> self, Closure predicate)
Used to determine if the given predicate closure is valid (i.e.static boolean
every(Object self)
Iterates over every element of a collection, and checks whether all elements aretrue
according to the Groovy Truth.static boolean
every(Object self, Closure predicate)
Used to determine if the given predicate closure is valid (i.e.static <T> boolean
every(Iterator<T> self, Closure predicate)
Used to determine if the given predicate closure is valid (i.e.static <K,V>
booleanevery(Map<K,V> self, Closure predicate)
Iterates over the entries of a map, and checks whether a predicate is valid for all entries.static <T> boolean
every(T[] self, Closure predicate)
Used to determine if the given predicate closure is valid (i.e.static Process
execute(String self)
Deprecated.static Process
execute(String[] commandArray)
Deprecated.static Process
execute(String[] commandArray, String[] envp, File dir)
Deprecated.static Process
execute(String[] commandArray, List envp, File dir)
Deprecated.static Process
execute(String self, String[] envp, File dir)
Deprecated.static Process
execute(String self, List envp, File dir)
Deprecated.static Process
execute(List commands)
Deprecated.static Process
execute(List commands, String[] envp, File dir)
Deprecated.static Process
execute(List commands, List envp, File dir)
Deprecated.static CharSequence
expand(CharSequence self)
Deprecated.static CharSequence
expand(CharSequence self, int tabStop)
Deprecated.static String
expand(String self)
Deprecated.static String
expand(String self, int tabStop)
Deprecated.static CharSequence
expandLine(CharSequence self, int tabStop)
Deprecated.static String
expandLine(String self, int tabStop)
Deprecated.static Writable
filterLine(File self, Closure closure)
Deprecated.static void
filterLine(File self, Writer writer, Closure closure)
Deprecated.static void
filterLine(File self, Writer writer, String charset, Closure closure)
Deprecated.static Writable
filterLine(File self, String charset, Closure closure)
Deprecated.static Writable
filterLine(InputStream self, Closure predicate)
Deprecated.static void
filterLine(InputStream self, Writer writer, Closure predicate)
Deprecated.static void
filterLine(InputStream self, Writer writer, String charset, Closure predicate)
Deprecated.static Writable
filterLine(InputStream self, String charset, Closure predicate)
Deprecated.static Writable
filterLine(Reader reader, Closure closure)
Deprecated.static void
filterLine(Reader reader, Writer writer, Closure closure)
Deprecated.static Writable
filterLine(URL self, Closure predicate)
Deprecated.static void
filterLine(URL self, Writer writer, Closure predicate)
Deprecated.static void
filterLine(URL self, Writer writer, String charset, Closure predicate)
Deprecated.static Writable
filterLine(URL self, String charset, Closure predicate)
Deprecated.static CharSequence
find(CharSequence self, CharSequence regex)
Deprecated.static CharSequence
find(CharSequence self, CharSequence regex, Closure closure)
Deprecated.static CharSequence
find(CharSequence self, Pattern pattern)
Deprecated.static CharSequence
find(CharSequence self, Pattern pattern, Closure closure)
Deprecated.static Object
find(Object self)
Finds the first item matching the IDENTITY Closure (i.e. matching Groovy truth).static Object
find(Object self, Closure closure)
Finds the first value matching the closure condition.static String
find(String self, String regex)
Deprecated.static String
find(String self, String regex, Closure closure)
Deprecated.static String
find(String self, Pattern pattern)
Deprecated.static String
find(String self, Pattern pattern, Closure closure)
Deprecated.static <T> T
find(Collection<T> self)
Finds the first item matching the IDENTITY Closure (i.e. matching Groovy truth).static <T> T
find(Collection<T> self, Closure closure)
Finds the first value matching the closure condition.static <K,V>
Map.Entry<K,V>find(Map<K,V> self, Closure<?> closure)
Finds the first entry matching the closure condition.static <T> T
find(T[] self, Closure condition)
Finds the first element in the array that matches the given closure condition.static List<String>
findAll(CharSequence self, CharSequence regex)
Deprecated.static <T> List<T>
findAll(CharSequence self, CharSequence regex, Closure<T> closure)
Deprecated.static List<String>
findAll(CharSequence self, Pattern pattern)
Deprecated.static <T> List<T>
findAll(CharSequence self, Pattern pattern, Closure<T> closure)
Deprecated.static Collection
findAll(Object self)
Finds all items matching the IDENTITY Closure (i.e. matching Groovy truth).static Collection
findAll(Object self, Closure closure)
Finds all items matching the closure condition.static List<String>
findAll(String self, String regex)
Deprecated.static <T> List<T>
findAll(String self, String regex, Closure<T> closure)
Deprecated.static List<String>
findAll(String self, Pattern pattern)
Deprecated.static <T> List<T>
findAll(String self, Pattern pattern, Closure<T> closure)
Deprecated.static <T> Collection<T>
findAll(Collection<T> self)
Finds the items matching the IDENTITY Closure (i.e. matching Groovy truth).static <T> Collection<T>
findAll(Collection<T> self, Closure closure)
Finds all values matching the closure condition.static <T> List<T>
findAll(List<T> self)
Finds the items matching the IDENTITY Closure (i.e. matching Groovy truth).static <T> List<T>
findAll(List<T> self, Closure closure)
Finds all values matching the closure condition.static <K,V>
Map<K,V>findAll(Map<K,V> self, Closure closure)
Finds all entries matching the closure condition.static <T> Set<T>
findAll(Set<T> self)
Finds the items matching the IDENTITY Closure (i.e. matching Groovy truth).static <T> Set<T>
findAll(Set<T> self, Closure closure)
Finds all values matching the closure condition.static <T> Collection<T>
findAll(T[] self)
Finds the elements of the array matching the IDENTITY Closure (i.e. matching Groovy truth).static <T> Collection<T>
findAll(T[] self, Closure condition)
Finds all elements of the array matching the given Closure condition.static <T> int
findIndexOf(Iterable<T> self, int startIndex, Closure 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.static <T> int
findIndexOf(Iterable<T> self, Closure condition)
Iterates over the elements of an Iterable and returns the index of the first item that satisfies the condition specified by the closure.static int
findIndexOf(Object self, int startIndex, Closure 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.static int
findIndexOf(Object self, Closure 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.static <T> int
findIndexOf(Iterator<T> self, int startIndex, Closure 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.static <T> int
findIndexOf(Iterator<T> self, Closure condition)
Iterates over the elements of an Iterator and returns the index of the first item that satisfies the condition specified by the closure.static <T> int
findIndexOf(T[] self, int startIndex, Closure 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.static <T> int
findIndexOf(T[] self, Closure condition)
Iterates over the elements of an Array and returns the index of the first item that satisfies the condition specified by the closure.static <T> List<Number>
findIndexValues(Iterable<T> self, Closure condition)
Iterates over the elements of an Iterable and returns the index values of the items that match the condition specified in the closure.static <T> List<Number>
findIndexValues(Iterable<T> self, Number startIndex, Closure 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.static List<Number>
findIndexValues(Object self, Closure 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.static List<Number>
findIndexValues(Object self, Number startIndex, Closure 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.static <T> List<Number>
findIndexValues(Iterator<T> self, Closure condition)
Iterates over the elements of an Iterator and returns the index values of the items that match the condition specified in the closure.static <T> List<Number>
findIndexValues(Iterator<T> self, Number startIndex, Closure 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.static <T> List<Number>
findIndexValues(T[] self, Closure condition)
Iterates over the elements of an Array and returns the index values of the items that match the condition specified in the closure.static <T> List<Number>
findIndexValues(T[] self, Number startIndex, Closure 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.static <T> int
findLastIndexOf(Iterable<T> self, int startIndex, Closure 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.static <T> int
findLastIndexOf(Iterable<T> self, Closure condition)
Iterates over the elements of an Iterable and returns the index of the last item that matches the condition specified in the closure.static int
findLastIndexOf(Object self, int startIndex, Closure 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.static int
findLastIndexOf(Object self, Closure 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.static <T> int
findLastIndexOf(Iterator<T> self, int startIndex, Closure 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.static <T> int
findLastIndexOf(Iterator<T> self, Closure condition)
Iterates over the elements of an Iterator and returns the index of the last item that matches the condition specified in the closure.static <T> int
findLastIndexOf(T[] self, int startIndex, Closure 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.static <T> int
findLastIndexOf(T[] self, Closure condition)
Iterates over the elements of an Array and returns the index of the last item that matches the condition specified in the closure.static <S,T,U extends T,V extends T>
TfindResult(Iterable<S> self, U defaultResult, Closure<V> 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.static <T,U>
TfindResult(Iterable<U> self, Closure<T> 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.static Object
findResult(Object self, Closure 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.static Object
findResult(Object self, Object defaultResult, Closure 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.static <S,T>
TfindResult(Collection<S> self, Closure<T> condition)
Deprecated.use the Iterable version insteadstatic <S,T,U extends T,V extends T>
TfindResult(Collection<S> self, U defaultResult, Closure<V> condition)
Deprecated.use the Iterable version insteadstatic <S,T,U extends T,V extends T>
TfindResult(Iterator<S> self, U defaultResult, Closure<V> 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.static <T,U>
TfindResult(Iterator<U> self, Closure<T> 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.static <T,U extends T,V extends T,A,B>
TfindResult(Map<A,B> self, U defaultResult, Closure<V> condition)
Returns the first non-null closure result found by passing each map entry to the closure, otherwise the defaultResult is returned.static <T,K,V>
TfindResult(Map<K,V> self, Closure<T> condition)
Returns the first non-null closure result found by passing each map entry to the closure, otherwise null is returned.static <S,T>
TfindResult(S[] self, Closure<T> 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.static <S,T,U extends T,V extends T>
TfindResult(S[] self, U defaultResult, Closure<V> 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.static <T,U>
Collection<T>findResults(Iterable<U> self, Closure<T> filteringTransform)
Iterates through the Iterable transforming items using the supplied closure and collecting any non-null results.static <T,U>
Collection<T>findResults(Collection<U> self, Closure<T> filteringTransform)
Deprecated.Use the Iterable version of findResults insteadstatic <T,U>
Collection<T>findResults(Iterator<U> self, Closure<T> filteringTransform)
Iterates through the Iterator transforming items using the supplied closure and collecting any non-null results.static <T,K,V>
Collection<T>findResults(Map<K,V> self, Closure<T> filteringTransform)
Iterates through the map transforming items using the supplied closure and collecting any non-null results.static <T,U>
Collection<T>findResults(U[] self, Closure<T> filteringTransform)
Iterates through the Array transforming items using the supplied closure and collecting any non-null results.static <T> T
first(Iterable<T> self)
Returns the first item from the Iterable.static <T> T
first(List<T> self)
Returns the first item from the List.static <T> T
first(T[] self)
Returns the first item from the array.static Collection
flatten(boolean[] self)
Flatten an array.static Collection
flatten(byte[] self)
Flatten an array.static Collection
flatten(char[] self)
Flatten an array.static Collection
flatten(double[] self)
Flatten an array.static Collection
flatten(float[] self)
Flatten an array.static Collection
flatten(int[] self)
Flatten an array.static Collection
flatten(long[] self)
Flatten an array.static Collection
flatten(short[] self)
Flatten an array.static Collection<?>
flatten(Iterable<?> self)
Flatten an Iterable.static <T> Collection<T>
flatten(Iterable<T> self, Closure<? extends T> flattenUsing)
Flatten an Iterable.static Collection
flatten(Object[] self)
Flatten an array.static Collection<?>
flatten(Collection<?> self)
Flatten a Collection.static <T> Collection<T>
flatten(Collection<T> self, Closure<? extends T> flattenUsing)
Deprecated.Use the Iterable version of flatten insteadstatic List<?>
flatten(List<?> self)
Flatten a List.static Set<?>
flatten(Set<?> self)
Flatten a Set.static SortedSet<?>
flatten(SortedSet<?> self)
Flatten a SortedSet.static <K,V>
Vget(Map<K,V> map, K key, V 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.static List<Boolean>
getAt(boolean[] array, IntRange range)
Support the subscript operator with an IntRange for a boolean arraystatic List<Boolean>
getAt(boolean[] array, ObjectRange range)
Support the subscript operator with an ObjectRange for a byte arraystatic List<Boolean>
getAt(boolean[] array, Range range)
Support the subscript operator with a range for a boolean arraystatic List<Boolean>
getAt(boolean[] array, Collection indices)
Support the subscript operator with a collection for a boolean arraystatic List<Byte>
getAt(byte[] array, IntRange range)
Support the subscript operator with an IntRange for a byte arraystatic List<Byte>
getAt(byte[] array, ObjectRange range)
Support the subscript operator with an ObjectRange for a byte arraystatic List<Byte>
getAt(byte[] array, Range range)
Support the subscript operator with a range for a byte arraystatic List<Byte>
getAt(byte[] array, Collection indices)
Support the subscript operator with a collection for a byte arraystatic List<Character>
getAt(char[] array, IntRange range)
Support the subscript operator with an IntRange for a char arraystatic List<Character>
getAt(char[] array, ObjectRange range)
Support the subscript operator with an ObjectRange for a char arraystatic List<Character>
getAt(char[] array, Range range)
Support the subscript operator with a range for a char arraystatic List<Character>
getAt(char[] array, Collection indices)
Support the subscript operator with a collection for a char arraystatic List<Double>
getAt(double[] array, IntRange range)
Support the subscript operator with an IntRange for a double arraystatic List<Double>
getAt(double[] array, ObjectRange range)
Support the subscript operator with an ObjectRange for a double arraystatic List<Double>
getAt(double[] array, Range range)
Support the subscript operator with a range for a double arraystatic List<Double>
getAt(double[] array, Collection indices)
Support the subscript operator with a collection for a double arraystatic List<Float>
getAt(float[] array, IntRange range)
Support the subscript operator with an IntRange for a float arraystatic List<Float>
getAt(float[] array, ObjectRange range)
Support the subscript operator with an ObjectRange for a float arraystatic List<Float>
getAt(float[] array, Range range)
Support the subscript operator with a range for a float arraystatic List<Float>
getAt(float[] array, Collection indices)
Support the subscript operator with a collection for a float arraystatic List<Integer>
getAt(int[] array, IntRange range)
Support the subscript operator with an IntRange for an int arraystatic List<Integer>
getAt(int[] array, ObjectRange range)
Support the subscript operator with an ObjectRange for an int arraystatic List<Integer>
getAt(int[] array, Range range)
Support the subscript operator with a range for an int arraystatic List<Integer>
getAt(int[] array, Collection indices)
Support the subscript operator with a collection for an int arraystatic List<Long>
getAt(long[] array, IntRange range)
Support the subscript operator with an IntRange for a long arraystatic List<Long>
getAt(long[] array, ObjectRange range)
Support the subscript operator with an ObjectRange for a long arraystatic List<Long>
getAt(long[] array, Range range)
Support the subscript operator with a range for a long arraystatic List<Long>
getAt(long[] array, Collection indices)
Support the subscript operator with a collection for a long arraystatic List<Short>
getAt(short[] array, IntRange range)
Support the subscript operator with an IntRange for a short arraystatic List<Short>
getAt(short[] array, ObjectRange range)
Support the subscript operator with an ObjectRange for a short arraystatic List<Short>
getAt(short[] array, Range range)
Support the subscript operator with a range for a short arraystatic List<Short>
getAt(short[] array, Collection indices)
Support the subscript operator with a collection for a short arraystatic <T> List<T>
getAt(ListWithDefault<T> self, EmptyRange range)
Support the range subscript operator for an eager or lazy List.static <T> List<T>
getAt(ListWithDefault<T> self, Range range)
Support the range subscript operator for an eager or lazy List.static <T> List<T>
getAt(ListWithDefault<T> self, Collection indices)
Select a List of items from an eager or lazy List using a Collection to identify the indices to be selected.static CharSequence
getAt(CharSequence text, int index)
Deprecated.static CharSequence
getAt(CharSequence text, EmptyRange range)
Deprecated.static CharSequence
getAt(CharSequence text, IntRange range)
Deprecated.static CharSequence
getAt(CharSequence text, Range range)
Deprecated.static CharSequence
getAt(CharSequence self, Collection indices)
Deprecated.static <T> T
getAt(Iterable<T> self, int idx)
Support the subscript operator for an Iterable.static Object
getAt(Object self, String property)
Allows the subscript operator to be used to lookup dynamic property values.static String
getAt(String text, int index)
Deprecated.static String
getAt(String text, EmptyRange range)
Deprecated.static String
getAt(String text, IntRange range)
Deprecated.static String
getAt(String text, Range range)
Deprecated.static String
getAt(String self, Collection indices)
Deprecated.static boolean
getAt(BitSet self, int index)
Support the subscript operator for a Bitsetstatic BitSet
getAt(BitSet self, IntRange range)
Support retrieving a subset of a BitSet using a Rangestatic List
getAt(Collection coll, String property)
Support the subscript operator for Collection.static <T> T
getAt(Iterator<T> self, int idx)
Support the subscript operator for an Iterator.static <T> T
getAt(List<T> self, int idx)
Support the subscript operator for a List.static <T> List<T>
getAt(List<T> self, EmptyRange range)
Support the range subscript operator for a List.static <T> List<T>
getAt(List<T> self, Range range)
Support the range subscript operator for a List.static <T> T
getAt(List<T> self, Number idx)
Support subscript operator for list access.static <T> List<T>
getAt(List<T> self, Collection indices)
Select a List of items from a List using a Collection to identify the indices to be selected.static <K,V>
VgetAt(Map<K,V> self, K key)
Support the subscript operator for a Map.static Object
getAt(Matcher matcher, int idx)
Deprecated.static List
getAt(Matcher self, Collection indices)
Deprecated.static <T> List<T>
getAt(T[] array, EmptyRange range)
static <T> List<T>
getAt(T[] array, IntRange range)
static <T> List<T>
getAt(T[] array, ObjectRange range)
static <T> List<T>
getAt(T[] array, Range range)
Support the range subscript operator for an Arraystatic <T> List<T>
getAt(T[] self, Collection indices)
Select a List of items from an array using a Collection to identify the indices to be selected.static byte[]
getBytes(File file)
Deprecated.static byte[]
getBytes(InputStream is)
Deprecated.static byte[]
getBytes(URL url)
Deprecated.static char[]
getChars(CharSequence self)
Deprecated.static char[]
getChars(String self)
Deprecated.static int
getCount(Matcher matcher)
Deprecated.static IntRange
getIndices(Collection self)
Returns indices of the collection.static <T> IntRange
getIndices(T[] self)
Returns indices of the array.static URL
getLocation(Class self)
Gets the url of the jar file/source file containing the specified classstatic MetaClass
getMetaClass(GroovyObject obj)
Obtains a MetaClass for an object either from the registry or in the case of a GroovyObject from the object itself.static MetaClass
getMetaClass(Class c)
Adds a "metaClass" property to all class objects so you can use the syntaxString.metaClass.myMethod = { println "foo" }
static MetaClass
getMetaClass(Object obj)
Obtains a MetaClass for an object either from the registry or in the case of a GroovyObject from the object itself.static List<PropertyValue>
getMetaPropertyValues(Object self)
Retrieves the list ofMetaProperty
objects for 'self' and wraps it in a list ofPropertyValue
objects that additionally provide the value for each property of 'self'.static Map
getProperties(Object self)
Convenience method that callsgetMetaPropertyValues(java.lang.Object)
(self) and provides the data in form of simple key/value pairs, i.e.static ClassLoader
getRootLoader(ClassLoader self)
Iterates through the classloader parents until it finds a loader with a class named "org.codehaus.groovy.tools.RootLoader".protected static List
getSubList(List self, List splice)
Deprecated.static String
getText(BufferedReader reader)
Deprecated.static String
getText(File file)
Deprecated.static String
getText(File file, String charset)
Deprecated.static String
getText(InputStream is)
Deprecated.static String
getText(InputStream is, String charset)
Deprecated.static String
getText(Reader reader)
Deprecated.static String
getText(URL url)
Deprecated.static String
getText(URL url, String charset)
Deprecated.static String
getText(URL url, Map parameters)
Deprecated.static String
getText(URL url, Map parameters, String charset)
Deprecated.static Collection
grep(Object 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.static Collection
grep(Object self, Object filter)
Iterates over the collection of items which this Object represents and returns each item that matches the given filter - calling the
method used by switch statements.isCase(java.lang.Object, java.lang.Object)
static <T> Collection<T>
grep(Collection<T> 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.static <T> Collection<T>
grep(Collection<T> self, Object filter)
Iterates over the collection of items and returns each item that matches the given filter - calling the
method used by switch statements.isCase(java.lang.Object, java.lang.Object)
static <T> List<T>
grep(List<T> 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.static <T> List<T>
grep(List<T> self, Object filter)
Iterates over the collection of items and returns each item that matches the given filter - calling the
method used by switch statements.isCase(java.lang.Object, java.lang.Object)
static <T> Set<T>
grep(Set<T> 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.static <T> Set<T>
grep(Set<T> self, Object filter)
Iterates over the collection of items and returns each item that matches the given filter - calling the
method used by switch statements.isCase(java.lang.Object, java.lang.Object)
static <T> Collection<T>
grep(T[] 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.static <T> Collection<T>
grep(T[] self, Object filter)
Iterates over the array of items and returns a collection of items that match the given filter - calling the
method used by switch statements.isCase(java.lang.Object, java.lang.Object)
protected static <K,T>
voidgroupAnswer(Map<K,List<T>> answer, T element, K value)
Groups the current element according to the valuestatic <K,T>
Map<K,List<T>>groupBy(Iterable<T> self, Closure<K> closure)
Sorts all Iterable members into groups determined by the supplied mapping closure.static Map
groupBy(Iterable self, Object... closures)
Sorts all Iterable members into (sub)groups determined by the supplied mapping closures.static Map
groupBy(Iterable self, List<Closure> closures)
Sorts all Iterable members into (sub)groups determined by the supplied mapping closures.static Map
groupBy(Object[] self, Object... closures)
Sorts all array members into (sub)groups determined by the supplied mapping closures as per the Iterable variant of this method.static Map
groupBy(Object[] self, List<Closure> closures)
Sorts all array members into (sub)groups determined by the supplied mapping closures as per the list variant of this method.static <K,T>
Map<K,List<T>>groupBy(Collection<T> self, Closure<K> closure)
Deprecated.Use the Iterable version of groupBy insteadstatic Map
groupBy(Collection self, Object... closures)
Deprecated.Use the Iterable version of groupBy insteadstatic Map
groupBy(Collection self, List<Closure> closures)
Deprecated.Use the Iterable version of groupBy insteadstatic <G,K,V>
Map<G,Map<K,V>>groupBy(Map<K,V> self, Closure<G> closure)
Groups the members of a map into sub maps determined by the supplied mapping closure.static Map<Object,Map>
groupBy(Map self, Object... closures)
Groups the members of a map into sub maps determined by the supplied mapping closures.static Map<Object,Map>
groupBy(Map self, List<Closure> closures)
Groups the members of a map into sub maps determined by the supplied mapping closures.static <K,T>
Map<K,List<T>>groupBy(T[] self, Closure<K> closure)
Sorts all array members into groups determined by the supplied mapping closure.static <G,K,V>
Map<G,List<Map.Entry<K,V>>>groupEntriesBy(Map<K,V> self, Closure<G> closure)
Groups all map entries into groups determined by the supplied mapping closure.static boolean
hasGroup(Matcher matcher)
Deprecated.static MetaProperty
hasProperty(Object self, String name)
Returns true of the implementing MetaClass has a property of the given namestatic <T> T
head(Iterable<T> self)
Returns the first item from the Iterable.static <T> T
head(List<T> self)
Returns the first item from the List.static <T> T
head(T[] self)
Returns the first item from the Object array.static <T,U>
Tidentity(U self, Closure<T> closure)
Allows the closure to be called for the object reference self.static Boolean
implies(Boolean left, Boolean right)
Logical implication of two boolean operatorsstatic <E> Map<Integer,E>
indexed(Iterable<E> self)
Zips an Iterable with indices in (index, value) order.static <E> Map<Integer,E>
indexed(Iterable<E> self, int offset)
Zips an Iterable with indices in (index, value) order.static <E> Iterator<Tuple2<Integer,E>>
indexed(Iterator<E> self)
Zips an iterator with indices in (index, value) order.static <E> Iterator<Tuple2<Integer,E>>
indexed(Iterator<E> self, int offset)
Zips an iterator with indices in (index, value) order.static <T> Collection<T>
init(Iterable<T> self)
Returns the items from the Iterable excluding the last item.static <T> Iterator<T>
init(Iterator<T> self)
Returns an Iterator containing all of the items from this iterator except the last one.static <T> List<T>
init(List<T> self)
Returns the items from the List excluding the last item.static <T> SortedSet<T>
init(SortedSet<T> self)
Returns the items from the SortedSet excluding the last item.static <T> T[]
init(T[] self)
Returns the items from the Object array excluding the last item.static <T> List<List<T>>
inits(Iterable<T> 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.static <E,T,V extends T>
Tinject(E[] self, Closure<V> 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.static <E,T,U extends T,V extends T>
Tinject(E[] self, U initialValue, Closure<V> closure)
Iterates through the given array, passing in the initial value to the closure along with the first item.static <T,V extends T>
Tinject(Object self, Closure<V> closure)
Iterates through the given Object, passing in the first value to the closure along with the first item.static <T,U extends T,V extends T>
Tinject(Object self, U initialValue, Closure<V> closure)
Iterates through the given Object, passing in the initial value to the closure along with the first item.static <E,T,U extends T,V extends T>
Tinject(Collection<E> self, U initialValue, Closure<V> closure)
Iterates through the given Collection, passing in the initial value to the 2-arg closure along with the first item.static <T,V extends T>
Tinject(Collection<T> self, Closure<V> 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.static <E,T,U extends T,V extends T>
Tinject(Iterator<E> self, U initialValue, Closure<V> closure)
Iterates through the given Iterator, passing in the initial value to the closure along with the first item.static <K,V,T,U extends T,W extends T>
Tinject(Map<K,V> self, U initialValue, Closure<W> 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).static String
inspect(Object self)
Inspects returns the String that matches what would be typed into a terminal to create this object.static Number
intdiv(Character left, Character right)
Integer Divide two Characters.static Number
intdiv(Character left, Number right)
Integer Divide a Character by a Number.static Number
intdiv(Number left, Character right)
Integer Divide a Number by a Character.static Number
intdiv(Number left, Number right)
Integer Divide two Numbers.static <T> Collection<T>
intersect(Iterable<T> left, Iterable<T> right)
Create a Collection composed of the intersection of both iterables.static <T> Collection<T>
intersect(Iterable<T> left, Iterable<T> right, Comparator<T> comparator)
Create a Collection composed of the intersection of both iterables.static <T> Collection<T>
intersect(Collection<T> left, Collection<T> right)
Create a Collection composed of the intersection of both collections.static <T> Collection<T>
intersect(Collection<T> left, Collection<T> right, Comparator<T> comparator)
Create a Collection composed of the intersection of both collections.static <T> List<T>
intersect(List<T> left, Iterable<T> right)
Create a List composed of the intersection of a List and an Iterable.static <T> List<T>
intersect(List<T> left, Iterable<T> right, Comparator<T> comparator)
Create a List composed of the intersection of a List and an Iterable.static <K,V>
Map<K,V>intersect(Map<K,V> left, Map<K,V> right)
Create a Map composed of the intersection of both maps.static <T> Set<T>
intersect(Set<T> left, Iterable<T> right)
Create a Set composed of the intersection of a Set and an Iterable.static <T> Set<T>
intersect(Set<T> left, Iterable<T> right, Comparator<T> comparator)
Create a Set composed of the intersection of a Set and an Iterable.static <T> SortedSet<T>
intersect(SortedSet<T> left, Iterable<T> right)
Create a SortedSet composed of the intersection of a SortedSet and an Iterable.static <T> SortedSet<T>
intersect(SortedSet<T> left, Iterable<T> right, Comparator<T> comparator)
Create a SortedSet composed of the intersection of a SortedSet and an Iterable.static Object
invokeMethod(Object object, String method, Object arguments)
Provide a dynamic method invocation method which can be overloaded in classes to implement dynamic proxies easily.static boolean
is(Object self, Object other)
Identity check.static boolean
isAllWhitespace(CharSequence self)
Deprecated.static boolean
isAllWhitespace(String self)
Deprecated.static Boolean
isAtLeast(BigDecimal left, String right)
Compare a BigDecimal to a String representing a number.static Boolean
isAtLeast(BigDecimal left, BigDecimal right)
Compare a BigDecimal to another.static boolean
isBigDecimal(CharSequence self)
Deprecated.static boolean
isBigDecimal(String self)
Deprecated.static boolean
isBigInteger(CharSequence self)
Deprecated.static boolean
isBigInteger(String self)
Deprecated.static boolean
isCase(GString caseValue, Object switchValue)
Deprecated.static boolean
isCase(CharSequence caseValue, Object switchValue)
Deprecated.static boolean
isCase(Class caseValue, Object switchValue)
Special 'Case' implementation for Class, which allows testing for a certain class in a switch statement.static boolean
isCase(Number caseValue, Number switchValue)
Special 'case' implementation for all numbers, which delegates to thecompareTo()
method for comparing numbers of different types.static boolean
isCase(Object caseValue, Object switchValue)
Method for overloading the behavior of the 'case' method in switch statements.static boolean
isCase(String caseValue, Object switchValue)
Deprecated.static boolean
isCase(Collection caseValue, Object switchValue)
'Case' implementation for collections which tests if the 'switch' operand is contained in any of the 'case' values.static boolean
isCase(Map caseValue, Object switchValue)
'Case' implementation for maps which tests the groovy truth value obtained using the 'switch' operand as key.static boolean
isCase(Pattern caseValue, Object switchValue)
Deprecated.static boolean
isDigit(Character self)
Determines if a character is a digit.static boolean
isDouble(CharSequence self)
Deprecated.static boolean
isDouble(String self)
Deprecated.static boolean
isEmpty(Iterable self)
Check whether anIterable
has elementsstatic boolean
isFloat(CharSequence self)
Deprecated.static boolean
isFloat(String self)
Deprecated.static boolean
isInteger(CharSequence self)
Deprecated.static boolean
isInteger(String self)
Deprecated.static boolean
isLetter(Character self)
Determines if a character is a letter.static boolean
isLetterOrDigit(Character self)
Determines if a character is a letter or digit.static boolean
isLong(CharSequence self)
Deprecated.static boolean
isLong(String self)
Deprecated.static boolean
isLowerCase(Character self)
Determine if a Character is lowercase.static boolean
isNumber(CharSequence self)
Deprecated.static boolean
isNumber(String self)
Deprecated.static boolean
isUpperCase(Character self)
Determine if a Character is uppercase.static boolean
isWhitespace(Character self)
Determines if a character is a whitespace character.static Iterator<Byte>
iterator(DataInputStream self)
Deprecated.static Iterator<Byte>
iterator(InputStream self)
Deprecated.static Iterator<String>
iterator(Reader self)
Deprecated.static Iterator
iterator(Object o)
Attempts to create an Iterator for the given object by first converting it to a Collection.static <T> Iterator<T>
iterator(Enumeration<T> enumeration)
Allows an Enumeration to behave like an Iterator.static <T> Iterator<T>
iterator(Iterator<T> 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.static Iterator
iterator(Matcher matcher)
Deprecated.static <T> Iterator<T>
iterator(T[] a)
Attempts to create an Iterator for the given object by first converting it to a Collection.static String
join(boolean[] self, String separator)
Concatenates the string representation of each items in this array, with the given String as a separator between each item.static String
join(byte[] self, String separator)
Concatenates the string representation of each items in this array, with the given String as a separator between each item.static String
join(char[] self, String separator)
Concatenates the string representation of each items in this array, with the given String as a separator between each item.static String
join(double[] self, String separator)
Concatenates the string representation of each items in this array, with the given String as a separator between each item.static String
join(float[] self, String separator)
Concatenates the string representation of each items in this array, with the given String as a separator between each item.static String
join(int[] self, String separator)
Concatenates the string representation of each items in this array, with the given String as a separator between each item.static String
join(long[] self, String separator)
Concatenates the string representation of each items in this array, with the given String as a separator between each item.static String
join(short[] self, String separator)
Concatenates the string representation of each items in this array, with the given String as a separator between each item.static String
join(Iterable self, String separator)
Concatenates thetoString()
representation of each item in this Iterable, with the given String as a separator between each item.static String
join(Object[] self, String separator)
Concatenates thetoString()
representation of each items in this array, with the given String as a separator between each item.static String
join(Collection self, String separator)
Deprecated.Use the Iterable version of join insteadstatic String
join(Iterator<Object> self, String separator)
Concatenates thetoString()
representation of each item from the iterator, with the given String as a separator between each item.static <T> T
last(Iterable<T> self)
Returns the last item from the Iterable.static <T> T
last(Deque<T> self)
An optimized version oflast(List)
.static <T> T
last(List<T> self)
Returns the last item from the List.static <T> T
last(T[] self)
Returns the last item from the array.static File
leftShift(File file, byte[] bytes)
Deprecated.static File
leftShift(File file, InputStream data)
Deprecated.static File
leftShift(File file, Object text)
Deprecated.static void
leftShift(ObjectOutputStream self, Object value)
Deprecated.static OutputStream
leftShift(OutputStream self, byte[] value)
Deprecated.static OutputStream
leftShift(OutputStream self, InputStream in)
Deprecated.static Writer
leftShift(OutputStream self, Object value)
Deprecated.static Writer
leftShift(Writer self, Object value)
Deprecated.static StringBuilder
leftShift(CharSequence self, Object value)
Deprecated.static Number
leftShift(Number self, Number operand)
Implementation of the left shift operator for integral types.static StringBuffer
leftShift(StringBuffer self, Object value)
Deprecated.static StringBuilder
leftShift(StringBuilder self, Object value)
Deprecated.static StringBuffer
leftShift(String self, Object value)
Deprecated.static OutputStream
leftShift(Socket self, byte[] value)
Deprecated.static Writer
leftShift(Socket self, Object value)
Deprecated.static <T> Collection<T>
leftShift(Collection<T> self, T value)
Overloads the left shift operator to provide an easy way to append objects to a Collection.static <T> BlockingQueue<T>
leftShift(BlockingQueue<T> self, T value)
Overloads the left shift operator to provide an easy way to append objects to a BlockingQueue.static <T> List<T>
leftShift(List<T> self, T value)
Overloads the left shift operator to provide an easy way to append objects to a List.static <K,V>
Map<K,V>leftShift(Map<K,V> self, Map.Entry<K,V> entry)
Overloads the left shift operator to provide an easy way to append Map.Entry values to a Map.static <K,V>
Map<K,V>leftShift(Map<K,V> self, Map<K,V> other)
Overloads the left shift operator to provide an easy way to put one maps entries into another map.static <T> Set<T>
leftShift(Set<T> self, T value)
Overloads the left shift operator to provide an easy way to append objects to a Set.static <T> SortedSet<T>
leftShift(SortedSet<T> self, T value)
Overloads the left shift operator to provide an easy way to append objects to a SortedSet.static boolean
matches(CharSequence self, Pattern pattern)
Deprecated.static boolean
matches(String self, Pattern pattern)
Deprecated.static <T> T
max(Iterable<T> self)
Adds max() method to Iterable objects.static <T> T
max(Iterable<T> self, Closure closure)
Selects the item in the iterable which when passed as a parameter to the supplied closure returns the maximum value.static <T> T
max(Iterable<T> self, Comparator<T> comparator)
Selects the maximum value found in the Iterable using the given comparator.static <T> T
max(Collection<T> self)
Deprecated.Use the Iterable version of max insteadstatic <T> T
max(Collection<T> self, Closure closure)
Deprecated.Use the Iterable version of max insteadstatic <T> T
max(Collection<T> self, Comparator<T> comparator)
Deprecated.Use the Iterable version of max insteadstatic <T> T
max(Iterator<T> self)
Adds max() method to Iterator objects.static <T> T
max(Iterator<T> self, Closure closure)
Selects the maximum value found from the Iterator using the closure to determine the correct ordering.static <T> T
max(Iterator<T> self, Comparator<T> comparator)
Selects the maximum value found from the Iterator using the given comparator.static <K,V>
Map.Entry<K,V>max(Map<K,V> self, Closure closure)
Selects an entry in the map having the maximum calculated value as determined by the supplied closure.static <T> T
max(T[] self)
Adds max() method to Object arrays.static <T> T
max(T[] self, Closure closure)
Selects the maximum value found from the Object array using the closure to determine the correct ordering.static <T> T
max(T[] self, Comparator<T> comparator)
Selects the maximum value found from the Object array using the given comparator.static MetaClass
metaClass(Class self, Closure closure)
Sets/updates the metaclass for a given class to a closure.static MetaClass
metaClass(Object self, Closure closure)
Sets/updates the metaclass for a given object to a closure.static <T> T
min(Iterable<T> self)
Adds min() method to Collection objects.static <T> T
min(Iterable<T> self, Closure closure)
Selects the item in the iterable which when passed as a parameter to the supplied closure returns the minimum value.static <T> T
min(Iterable<T> self, Comparator<T> comparator)
Selects the minimum value found in the Iterable using the given comparator.static <T> T
min(Collection<T> self)
Deprecated.Use the Iterable version of min insteadstatic <T> T
min(Collection<T> self, Closure closure)
Deprecated.Use the Iterable version of min insteadstatic <T> T
min(Collection<T> self, Comparator<T> comparator)
Deprecated.Use the Iterable version of min insteadstatic <T> T
min(Iterator<T> self)
Adds min() method to Iterator objects.static <T> T
min(Iterator<T> self, Closure closure)
Selects the minimum value found from the Iterator using the closure to determine the correct ordering.static <T> T
min(Iterator<T> self, Comparator<T> comparator)
Selects the minimum value found from the Iterator using the given comparator.static <K,V>
Map.Entry<K,V>min(Map<K,V> self, Closure closure)
Selects an entry in the map having the minimum calculated value as determined by the supplied closure.static <T> T
min(T[] self)
Adds min() method to Object arrays.static <T> T
min(T[] self, Closure closure)
Selects the minimum value found from the Object array using the closure to determine the correct ordering.static <T> T
min(T[] self, Comparator<T> comparator)
Selects the minimum value found from the Object array using the given comparator.static Number
minus(Character left, Character right)
Subtract one Character from another.static Number
minus(Character left, Number right)
Subtract a Number from a Character.static CharSequence
minus(CharSequence self, Object target)
Deprecated.static <T> Collection<T>
minus(Iterable<T> self, Iterable<?> removeMe)
Create a new Collection composed of the elements of the first Iterable minus every occurrence of elements of the given Iterable.static <T> Collection<T>
minus(Iterable<T> self, Object removeMe)
Create a new Collection composed of the elements of the first Iterable minus every occurrence of the given element to remove.static Number
minus(Number left, Character right)
Subtract a Character from a Number.static String
minus(String self, Object target)
Deprecated.static <T> Collection<T>
minus(Collection<T> self, Collection<?> removeMe)
Create a new Collection composed of the elements of the first Collection minus every occurrence of elements of the given Collection.static <T> List<T>
minus(List<T> self, Iterable<?> removeMe)
Create a new List composed of the elements of the first List minus every occurrence of elements of the given Iterable.static <T> List<T>
minus(List<T> self, Object removeMe)
Create a new List composed of the elements of the first List minus every occurrence of the given element to remove.static <T> List<T>
minus(List<T> self, Collection<?> removeMe)
Create a List composed of the elements of the first list minus every occurrence of elements of the given Collection.static <K,V>
Map<K,V>minus(Map<K,V> self, Map removeMe)
Create a Map composed of the entries of the first map minus the entries of the given map.static <T> Set<T>
minus(Set<T> self, Iterable<?> removeMe)
Create a Set composed of the elements of the first Set minus the elements from the given Iterable.static <T> Set<T>
minus(Set<T> self, Object removeMe)
Create a Set composed of the elements of the first Set minus the given element.static <T> Set<T>
minus(Set<T> self, Collection<?> removeMe)
Create a Set composed of the elements of the first Set minus the elements of the given Collection.static <T> SortedSet<T>
minus(SortedSet<T> self, Iterable<?> removeMe)
Create a SortedSet composed of the elements of the first SortedSet minus the elements of the given Iterable.static <T> SortedSet<T>
minus(SortedSet<T> self, Object removeMe)
Create a SortedSet composed of the elements of the first SortedSet minus the given element.static <T> SortedSet<T>
minus(SortedSet<T> self, Collection<?> removeMe)
Create a SortedSet composed of the elements of the first SortedSet minus the elements of the given Collection.static <T> T[]
minus(T[] self, Iterable removeMe)
Create an array composed of the elements of the first array minus the elements of the given Iterable.static <T> T[]
minus(T[] self, Object removeMe)
Create a new object array composed of the elements of the first array minus the element to remove.static <T> T[]
minus(T[] self, Object[] removeMe)
Create an array composed of the elements of the first array minus the elements of the given array.static void
mixin(MetaClass self, Class categoryClass)
Extend class globally with category methods.static void
mixin(MetaClass self, Class[] categoryClass)
Extend class globally with category methods.static void
mixin(MetaClass self, List<Class> categoryClasses)
Extend object with category methods.static void
mixin(Class self, Class categoryClass)
Extend class globally with category methods.static void
mixin(Class self, Class[] categoryClass)
Extend class globally with category methods.static void
mixin(Class self, List<Class> categoryClasses)
Extend class globally with category methods.static Number
mod(Number left, Number right)
Performs a division modulus operation.static Number
multiply(Character left, Character right)
Multiply two Characters.static Number
multiply(Character left, Number right)
Multiply a Character by a Number.static CharSequence
multiply(CharSequence self, Number factor)
Deprecated.static <T> Collection<T>
multiply(Iterable<T> self, Number factor)
Create a Collection composed of the elements of this Iterable, repeated a certain number of times.static Number
multiply(Number left, Character right)
Multiply a Number by a Character.static String
multiply(String self, Number factor)
Deprecated.static Number
multiply(BigDecimal left, Double right)
Multiply a BigDecimal and a Double.static Number
multiply(BigDecimal left, BigInteger right)
Multiply a BigDecimal and a BigInteger.static <T> Collection<T>
multiply(Collection<T> self, Number factor)
Deprecated.use the Iterable variant insteadstatic <T> List<T>
multiply(List<T> self, Number factor)
Create a List composed of the elements of this Iterable, repeated a certain number of times.static DataInputStream
newDataInputStream(File file)
Deprecated.static DataOutputStream
newDataOutputStream(File file)
Deprecated.static BufferedInputStream
newInputStream(File file)
Deprecated.static BufferedInputStream
newInputStream(URL url)
Deprecated.static BufferedInputStream
newInputStream(URL url, Map parameters)
Deprecated.static <T> T
newInstance(Class<T> c)
Convenience method to dynamically create a new instance of this class.static <T> T
newInstance(Class<T> c, Object[] args)
Helper to construct a new instance from the given arguments.static ObjectInputStream
newObjectInputStream(File file)
Deprecated.static ObjectInputStream
newObjectInputStream(File file, ClassLoader classLoader)
Deprecated.static ObjectInputStream
newObjectInputStream(InputStream inputStream)
Deprecated.static ObjectInputStream
newObjectInputStream(InputStream inputStream, ClassLoader classLoader)
Deprecated.static ObjectOutputStream
newObjectOutputStream(File file)
Deprecated.static ObjectOutputStream
newObjectOutputStream(OutputStream outputStream)
Deprecated.static BufferedOutputStream
newOutputStream(File file)
Deprecated.static PrintWriter
newPrintWriter(File file)
Deprecated.static PrintWriter
newPrintWriter(File file, String charset)
Deprecated.static PrintWriter
newPrintWriter(Writer writer)
Deprecated.static BufferedReader
newReader(File file)
Deprecated.static BufferedReader
newReader(File file, String charset)
Deprecated.static BufferedReader
newReader(InputStream self)
Deprecated.static BufferedReader
newReader(InputStream self, String charset)
Deprecated.static BufferedReader
newReader(URL url)
Deprecated.static BufferedReader
newReader(URL url, String charset)
Deprecated.static BufferedReader
newReader(URL url, Map parameters)
Deprecated.static BufferedReader
newReader(URL url, Map parameters, String charset)
Deprecated.static BufferedWriter
newWriter(File file)
Deprecated.static BufferedWriter
newWriter(File file, boolean append)
Deprecated.static BufferedWriter
newWriter(File file, String charset)
Deprecated.static BufferedWriter
newWriter(File file, String charset, boolean append)
Deprecated.static Character
next(Character self)
Increment a Character by one.static CharSequence
next(CharSequence self)
Deprecated.static Number
next(Number self)
Increment a Number by one.static String
next(String self)
Deprecated.static CharSequence
normalize(CharSequence self)
Deprecated.static String
normalize(String self)
Deprecated.static int
numberAwareCompareTo(Comparable self, Comparable other)
Provides a method that compares two comparables using Groovy's default number aware comparator.static Boolean
or(Boolean left, Boolean right)
Logical disjunction of two boolean operatorsstatic Number
or(Number left, Number right)
Bitwise OR together two numbers.static BitSet
or(BitSet left, BitSet right)
Bitwise OR together two BitSets.static CharSequence
padLeft(CharSequence self, Number numberOfChars)
Deprecated.static CharSequence
padLeft(CharSequence self, Number numberOfChars, CharSequence padding)
Deprecated.static String
padLeft(String self, Number numberOfChars)
Deprecated.static String
padLeft(String self, Number numberOfChars, String padding)
Deprecated.static CharSequence
padRight(CharSequence self, Number numberOfChars)
Deprecated.static CharSequence
padRight(CharSequence self, Number numberOfChars, CharSequence padding)
Deprecated.static String
padRight(String self, Number numberOfChars)
Deprecated.static String
padRight(String self, Number numberOfChars, String padding)
Deprecated.static <T> Set<List<T>>
permutations(Iterable<T> self)
Finds all permutations of an iterable.static <T,V>
List<V>permutations(Iterable<T> self, Closure<V> function)
Finds all permutations of an iterable, applies a function to each permutation and collects the result into a list.static <T> Set<List<T>>
permutations(List<T> self)
Deprecated.Use the Iterable version of permutations insteadstatic <T,V>
List<V>permutations(List<T> self, Closure<V> function)
Deprecated.Use the Iterable version of permutations insteadstatic Number
plus(Character left, Character right)
Add one Character to another.static Number
plus(Character left, Number right)
Add a Character and a Number.static CharSequence
plus(CharSequence left, Object value)
Deprecated.static <T> Collection<T>
plus(Iterable<T> left, Iterable<T> right)
Create a Collection as a union of two iterables.static <T> Collection<T>
plus(Iterable<T> left, T right)
Create a collection as a union of an Iterable and an Object.static Number
plus(Number left, Character right)
Add a Number and a Character.static String
plus(Number value, String right)
Deprecated.static String
plus(StringBuffer left, String value)
Deprecated.static String
plus(String left, Object value)
Deprecated.static <T> Collection<T>
plus(Collection<T> left, Iterable<T> right)
Create a Collection as a union of a Collection and an Iterable.static <T> Collection<T>
plus(Collection<T> left, Collection<T> right)
Create a Collection as a union of two collections.static <T> Collection<T>
plus(Collection<T> left, T right)
Create a collection as a union of a Collection and an Object.static <T> List<T>
plus(List<T> self, int index, Iterable<T> 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.static <T> List<T>
plus(List<T> self, int index, List<T> 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.static <T> List<T>
plus(List<T> self, int index, T[] 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.static <T> List<T>
plus(List<T> left, Iterable<T> right)
Create a List as a union of a List and an Iterable.static <T> List<T>
plus(List<T> left, Collection<T> right)
Create a List as a union of a List and a Collection.static <T> List<T>
plus(List<T> left, T right)
Create a List as a union of a List and an Object.static <K,V>
Map<K,V>plus(Map<K,V> self, Collection<? extends Map.Entry<? extends K,? extends V>> entries)
Returns a newMap
containing all entries fromself
andentries
, giving precedence toentries
.static <K,V>
Map<K,V>plus(Map<K,V> left, Map<K,V> right)
Returns a newMap
containing all entries fromleft
andright
, giving precedence toright
.static <T> Set<T>
plus(Set<T> left, Iterable<T> right)
Create a Set as a union of a Set and an Iterable.static <T> Set<T>
plus(Set<T> left, Collection<T> right)
Create a Set as a union of a Set and a Collection.static <T> Set<T>
plus(Set<T> left, T right)
Create a Set as a union of a Set and an Object.static <T> SortedSet<T>
plus(SortedSet<T> left, Iterable<T> right)
Create a SortedSet as a union of a SortedSet and an Iterable.static <T> SortedSet<T>
plus(SortedSet<T> left, Collection<T> right)
Create a SortedSet as a union of a SortedSet and a Collection.static <T> SortedSet<T>
plus(SortedSet<T> left, T right)
Create a SortedSet as a union of a SortedSet and an Object.static <T> T[]
plus(T[] left, Iterable<T> right)
Create an array containing elements from an original array plus those from an Iterable.static <T> T[]
plus(T[] left, Collection<T> right)
Create an array containing elements from an original array plus those from a Collection.static <T> T[]
plus(T[] left, T right)
Create an array containing elements from an original array plus an additional appended element.static <T> T[]
plus(T[] left, T[] right)
Create an array as a union of two arrays.static <T> T
pop(List<T> self)
Removes the initial item from the List.static Number
power(Integer self, Integer exponent)
Power of an integer to an integer certain exponent.static Number
power(Long self, Integer exponent)
Power of a long to an integer certain exponent.static Number
power(Number self, Number exponent)
Power of a Number to a certain exponent.static Number
power(BigDecimal self, Integer exponent)
Power of a BigDecimal to an integer certain exponent.static Number
power(BigInteger self, Integer exponent)
Power of a BigInteger to an integer certain exponent.static BigInteger
power(BigInteger self, BigInteger exponent)
Power of a BigInteger to a BigInteger certain exponent.static Character
previous(Character self)
Decrement a Character by one.static CharSequence
previous(CharSequence self)
Deprecated.static Number
previous(Number self)
Decrement a Number by one.static String
previous(String self)
Deprecated.protected static Object
primitiveArrayGet(Object self, int idx)
Implements the getAt(int) method for primitive type arrays.protected static List
primitiveArrayGet(Object self, Range range)
Implements the getAt(Range) method for primitive type arrays.protected static List
primitiveArrayGet(Object self, Collection indices)
Implements the getAt(Collection) method for primitive type arrays.protected static Object
primitiveArrayPut(Object self, int idx, Object newValue)
Implements the setAt(int idx) method for primitive type arrays.static void
print(Closure self, Object value)
Print a value to the standard output stream.static void
print(PrintStream self, Object value)
Print a value formatted Groovy style to the print stream.static void
print(PrintWriter self, Object value)
Print a value formatted Groovy style to the print writer.static void
print(Object self, PrintWriter out)
Print to a console in interactive format.static void
print(Object self, Object value)
Print a value formatted Groovy style to self if it is a Writer, otherwise to the standard output stream.static void
printf(Closure self, String format, Object value)
Printf a value to the standard output stream using a format string.static void
printf(Closure self, String format, Object[] values)
Printf 0 or more values to the standard output stream using a format string.static void
printf(Object self, String format, Object arg)
Prints a formatted string using the specified format string and arguments.static void
printf(Object self, String format, Object[] values)
Printf to the standard output stream.static void
println(Closure self)
Print a linebreak to the standard output stream.static void
println(Closure self, Object value)
Print a value (followed by a newline) to the standard output stream.static void
println(PrintStream self, Object value)
Print a value formatted Groovy style (followed by a newline) to the print stream.static void
println(PrintWriter self, Object value)
Print a value formatted Groovy style (followed by a newline) to the print writer.static void
println(Object self)
Print a linebreak to the standard output stream.static void
println(Object self, PrintWriter out)
Print to a console in interactive format.static void
println(Object self, Object value)
Print a value formatted Groovy style (followed by a newline) to self if it is a Writer, otherwise to the standard output stream.static <T> boolean
push(List<T> self, T value)
Prepends an item to the start of the List.static <K,V>
Map<K,V>putAll(Map<K,V> self, Collection<? extends Map.Entry<? extends K,? extends V>> entries)
Provides an easy way to append multiple Map.Entry values to a Map.static void
putAt(Object self, String property, Object newValue)
Allows the subscript operator to be used to set dynamically named property values.static void
putAt(StringBuffer self, EmptyRange range, Object value)
Deprecated.static void
putAt(StringBuffer self, IntRange range, Object value)
Deprecated.static void
putAt(BitSet self, int index, boolean value)
Support subscript-style assignment for a BitSet.static void
putAt(BitSet self, IntRange range, boolean value)
Support assigning a range of values with a single assignment statement.static <T> void
putAt(List<T> self, int idx, T value)
A helper method to allow lists to work with subscript operators.static <T> void
putAt(List<T> self, Number idx, T value)
Support subscript operator for list modification.static void
putAt(List self, EmptyRange range, Object value)
A helper method to allow lists to work with subscript operators.static void
putAt(List self, EmptyRange range, Collection value)
A helper method to allow lists to work with subscript operators.static void
putAt(List self, IntRange range, Object value)
List subscript assignment operator when given a range as the index.static void
putAt(List self, IntRange range, Collection col)
List subscript assignment operator when given a range as the index and the assignment operand is a collection.static void
putAt(List self, List splice, Object value)
A helper method to allow lists to work with subscript operators.static void
putAt(List self, List splice, List values)
A helper method to allow lists to work with subscript operators.static <K,V>
VputAt(Map<K,V> self, K key, V value)
A helper method to allow maps to work with subscript operatorsstatic byte[]
readBytes(File file)
Deprecated.static String
readLine(Reader self)
Deprecated.static List<String>
readLines(File file)
Deprecated.static List<String>
readLines(File file, String charset)
Deprecated.static List<String>
readLines(InputStream stream)
Deprecated.static List<String>
readLines(InputStream stream, String charset)
Deprecated.static List<String>
readLines(Reader reader)
Deprecated.static List<String>
readLines(CharSequence self)
Deprecated.static List<String>
readLines(String self)
Deprecated.static List<String>
readLines(URL self)
Deprecated.static List<String>
readLines(URL self, String charset)
Deprecated.static <T> boolean
removeAll(Collection<T> self, Closure condition)
Modifies this collection by removing the elements that are matched according to the specified closure condition.static boolean
removeAll(Collection self, Object[] items)
Modifies this collection by removing its elements that are contained within the specified object array.static <K,V>
booleanremoveAll(Map<K,V> self, Closure condition)
Modifies this map by removing the elements that are matched according to the specified closure condition.static <E> E
removeAt(List<E> self, int index)
Modifies this list by removing the element at the specified position in this list.static <E> boolean
removeElement(Collection<E> self, Object o)
Modifies this collection by removing a single instance of the specified element from this collection, if it is present.static <T> T
removeLast(List<T> self)
Removes the last item from the List.static boolean
renameTo(File self, String newPathName)
Deprecated.static CharSequence
replaceAll(CharSequence self, CharSequence regex, Closure closure)
Deprecated.static CharSequence
replaceAll(CharSequence self, CharSequence regex, CharSequence replacement)
Deprecated.static String
replaceAll(CharSequence self, Pattern pattern, Closure closure)
Deprecated.static CharSequence
replaceAll(CharSequence self, Pattern pattern, CharSequence replacement)
Deprecated.static String
replaceAll(String self, String regex, Closure closure)
Deprecated.static String
replaceAll(String self, Pattern pattern, Closure closure)
Deprecated.static String
replaceAll(String self, Pattern pattern, String replacement)
Deprecated.static String
replaceFirst(CharSequence self, CharSequence regex, Closure closure)
Deprecated.static String
replaceFirst(CharSequence self, CharSequence regex, CharSequence replacement)
Deprecated.static String
replaceFirst(CharSequence self, Pattern pattern, Closure closure)
Deprecated.static CharSequence
replaceFirst(CharSequence self, Pattern pattern, CharSequence replacement)
Deprecated.static String
replaceFirst(String self, String regex, Closure closure)
Deprecated.static String
replaceFirst(String self, Pattern pattern, Closure closure)
Deprecated.static String
replaceFirst(String self, Pattern pattern, String replacement)
Deprecated.static List<MetaMethod>
respondsTo(Object self, String name)
Returns an object satisfying Groovy truth if the implementing MetaClass responds to a method with the given name regardless of the arguments.static List<MetaMethod>
respondsTo(Object self, String name, Object[] argTypes)
Returns an object satisfying Groovy truth if the implementing MetaClass responds to a method with the given name and arguments types.static <T> boolean
retainAll(Collection<T> self, Closure condition)
Modifies this collection so that it retains only its elements that are matched according to the specified closure condition.static boolean
retainAll(Collection self, Object[] items)
Modifies this collection so that it retains only its elements that are contained in the specified array.static <K,V>
booleanretainAll(Map<K,V> self, Closure condition)
Modifies this map so that it retains only its elements that are matched according to the specified closure condition.static CharSequence
reverse(CharSequence self)
Deprecated.static String
reverse(String self)
Deprecated.static <T> Iterator<T>
reverse(Iterator<T> self)
Reverses the iterator.static <T> List<T>
reverse(List<T> self)
Creates a new List with the identical contents to this list but in reverse order.static <T> List<T>
reverse(List<T> self, boolean mutate)
Reverses the elements in a list.static <T> T[]
reverse(T[] self)
Creates a new array containing items which are the same as this array but in reverse order.static <T> T[]
reverse(T[] self, boolean mutate)
Reverse the items in an array.static <T> List<T>
reverseEach(List<T> self, Closure closure)
Iterate over each element of the list in the reverse order.static <K,V>
Map<K,V>reverseEach(Map<K,V> self, Closure closure)
Allows a Map to be iterated through in reverse order using a closure.static <T> T[]
reverseEach(T[] self, Closure closure)
Iterate over each element of the array in the reverse order.static Number
rightShift(Number self, Number operand)
Implementation of the right shift operator for integral types.static Number
rightShiftUnsigned(Number self, Number operand)
Implementation of the right shift (unsigned) operator for integral types.static long
round(Double number)
Round the valuestatic double
round(Double number, int precision)
Round the valuestatic int
round(Float number)
Round the valuestatic float
round(Float number, int precision)
Round the valuestatic BigDecimal
round(BigDecimal number)
Round the valuestatic BigDecimal
round(BigDecimal number, int precision)
Round the valuestatic TimerTask
runAfter(Timer timer, int delay, Closure closure)
Allows a simple syntax for using timers.static void
setBytes(File file, byte[] bytes)
Deprecated.static void
setBytes(OutputStream os, byte[] bytes)
Deprecated.static void
setIndex(Matcher matcher, int idx)
Deprecated.static void
setMetaClass(GroovyObject self, MetaClass metaClass)
Set the metaclass for a GroovyObject.static void
setMetaClass(Class self, MetaClass metaClass)
Sets the metaclass for a given class.static void
setMetaClass(Object self, MetaClass metaClass)
Set the metaclass for an object.static void
setText(File file, String text)
Deprecated.static void
setText(File file, String text, String charset)
Deprecated.static int
size(boolean[] array)
Allows arrays to behave similar to collections.static int
size(byte[] array)
Allows arrays to behave similar to collections.static int
size(char[] array)
Allows arrays to behave similar to collections.static int
size(double[] array)
Allows arrays to behave similar to collections.static int
size(float[] array)
Allows arrays to behave similar to collections.static int
size(int[] array)
Allows arrays to behave similar to collections.static int
size(long[] array)
Allows arrays to behave similar to collections.static int
size(short[] array)
Allows arrays to behave similar to collections.static long
size(File self)
Deprecated.static int
size(CharSequence text)
Deprecated.static int
size(Iterable self)
Provide the standard Groovysize()
method forIterable
.static int
size(Object[] self)
Provide the standard Groovysize()
method for an array.static int
size(String text)
Deprecated.static int
size(StringBuffer buffer)
Deprecated.static int
size(Iterator self)
Provide the standard Groovysize()
method forIterator
.static long
size(Matcher self)
Deprecated.static <T> List<T>
sort(Iterable<T> self)
Sorts the Collection.static <T> List<T>
sort(Iterable<T> self, boolean mutate)
Sorts the Iterable.static <T> List<T>
sort(Iterable<T> self, boolean mutate, Closure closure)
Sorts this Iterable using the given Closure to determine the correct ordering.static <T> List<T>
sort(Iterable<T> self, boolean mutate, Comparator<? super T> comparator)
Sorts the Iterable using the given Comparator.static <T> List<T>
sort(Iterable<T> self, Closure closure)
Sorts this Iterable using the given Closure to determine the correct ordering.static <T> List<T>
sort(Collection<T> self)
Deprecated.Use the Iterable version of sort insteadstatic <T> List<T>
sort(Collection<T> self, boolean mutate)
Deprecated.Use the Iterable version of sort insteadstatic <T> List<T>
sort(Collection<T> self, boolean mutate, Closure closure)
Deprecated.Use the Iterable version of sort insteadstatic <T> List<T>
sort(Collection<T> self, boolean mutate, Comparator<T> comparator)
Deprecated.Use the Iterable version of sort insteadstatic <T> List<T>
sort(Collection<T> self, Closure closure)
Deprecated.Use the Iterable version of sort insteadstatic <T> List<T>
sort(Collection<T> self, Comparator<T> comparator)
Deprecated.Use the Iterable version of sort insteadstatic <T> Iterator<T>
sort(Iterator<T> self)
Sorts the given iterator items into a sorted iterator.static <T> Iterator<T>
sort(Iterator<T> self, Closure closure)
Sorts the given iterator items into a sorted iterator using the Closure to determine the correct ordering.static <T> Iterator<T>
sort(Iterator<T> self, Comparator<? super T> comparator)
Sorts the given iterator items into a sorted iterator using the comparator.static <K,V>
Map<K,V>sort(Map<K,V> self)
Sorts the elements from the given map into a new ordered Map using the natural ordering of the keys to determine the ordering.static <K,V>
Map<K,V>sort(Map<K,V> self, Closure closure)
Sorts the elements from the given map into a new ordered map using the closure as a comparator to determine the ordering.static <K,V>
Map<K,V>sort(Map<K,V> self, Comparator<? super K> comparator)
Sorts the elements from the given map into a new ordered Map using the specified key comparator to determine the ordering.static <K,V>
SortedMap<K,V>sort(SortedMap<K,V> self)
Avoids doing unnecessary work when sorting an already sorted map (i.e.static <T> SortedSet<T>
sort(SortedSet<T> self)
Avoids doing unnecessary work when sorting an already sorted set (i.e.static <T> T[]
sort(T[] self)
Modifies this array so that its elements are in sorted order.static <T> T[]
sort(T[] self, boolean mutate)
Sorts the given array into sorted order.static <T> T[]
sort(T[] self, boolean mutate, Closure closure)
Modifies this array so that its elements are in sorted order using the Closure to determine the correct ordering.static <T> T[]
sort(T[] self, boolean mutate, Comparator<? super T> comparator)
Modifies this array so that its elements are in sorted order as determined by the given comparator.static <T> T[]
sort(T[] self, Closure closure)
Sorts the elements from this array into a newly created array using the Closure to determine the correct ordering.static <T> T[]
sort(T[] self, Comparator<? super T> comparator)
Sorts the given array into sorted order using the given comparator.static String[]
split(GString self)
Deprecated.static CharSequence[]
split(CharSequence self)
Deprecated.static Collection
split(Object self, Closure closure)
Splits all items into two lists based on the closure condition.static String[]
split(String self)
Deprecated.static <T> Collection<Collection<T>>
split(Collection<T> self, Closure closure)
Splits all items into two collections based on the closure condition.static <T> List<List<T>>
split(List<T> self, Closure closure)
Splits all items into two collections based on the closure condition.static <T> List<Set<T>>
split(Set<T> self, Closure closure)
Splits all items into two collections based on the closure condition.static <T> Collection<Collection<T>>
split(T[] self, Closure closure)
Splits all items into two collections based on the closure condition.static <T> T
splitEachLine(File self, String regex, Closure<T> closure)
Deprecated.static <T> T
splitEachLine(File self, String regex, String charset, Closure<T> closure)
Deprecated.static <T> T
splitEachLine(File self, Pattern pattern, Closure<T> closure)
Deprecated.static <T> T
splitEachLine(File self, Pattern pattern, String charset, Closure<T> closure)
Deprecated.static <T> T
splitEachLine(InputStream stream, String regex, Closure<T> closure)
Deprecated.static <T> T
splitEachLine(InputStream stream, String regex, String charset, Closure<T> closure)
Deprecated.static <T> T
splitEachLine(InputStream stream, Pattern pattern, Closure<T> closure)
Deprecated.static <T> T
splitEachLine(InputStream stream, Pattern pattern, String charset, Closure<T> closure)
Deprecated.static <T> T
splitEachLine(Reader self, String regex, Closure<T> closure)
Deprecated.static <T> T
splitEachLine(Reader self, Pattern pattern, Closure<T> closure)
Deprecated.static <T> T
splitEachLine(CharSequence self, CharSequence regex, Closure<T> closure)
Deprecated.static <T> T
splitEachLine(CharSequence self, Pattern pattern, Closure<T> closure)
Deprecated.static <T> T
splitEachLine(String self, String regex, Closure<T> closure)
Deprecated.static <T> T
splitEachLine(String self, Pattern pattern, Closure<T> closure)
Deprecated.static <T> T
splitEachLine(URL self, String regex, Closure<T> closure)
Deprecated.static <T> T
splitEachLine(URL self, String regex, String charset, Closure<T> closure)
Deprecated.static <T> T
splitEachLine(URL self, Pattern pattern, Closure<T> closure)
Deprecated.static <T> T
splitEachLine(URL self, Pattern pattern, String charset, Closure<T> closure)
Deprecated.static SpreadMap
spread(Map self)
Synonym fortoSpreadMap(java.util.Map)
.static String
sprintf(Object self, String format, Object arg)
Returns a formatted string using the specified format string and arguments.static String
sprintf(Object self, String format, Object[] values)
Sprintf to a string.static void
step(Number self, Number to, Number stepNumber, Closure closure)
Iterates from this number up to the given number using a step increment.static CharSequence
stripIndent(CharSequence self)
Deprecated.static CharSequence
stripIndent(CharSequence self, int numChars)
Deprecated.static String
stripIndent(String self)
Deprecated.static String
stripIndent(String self, int numChars)
Deprecated.static CharSequence
stripMargin(CharSequence self)
Deprecated.static CharSequence
stripMargin(CharSequence self, char marginChar)
Deprecated.static String
stripMargin(CharSequence self, CharSequence marginChar)
Deprecated.static String
stripMargin(String self)
Deprecated.static String
stripMargin(String self, char marginChar)
Deprecated.static String
stripMargin(String self, String marginChar)
Deprecated.static <K,V>
Map<K,V>subMap(Map<K,V> map, Collection<K> keys)
Creates a sub-Map containing the given keys.static <K,V>
Map<K,V>subMap(Map<K,V> map, K[] keys)
Creates a sub-Map containing the given keys.static <T> Set<List<T>>
subsequences(List<T> self)
Finds all non-null subsequences of a list.static byte
sum(byte[] self)
Sums the items in an array.static byte
sum(byte[] self, byte initialValue)
Sums the items in an array, adding the result to some initial value.static char
sum(char[] self)
Sums the items in an array.static char
sum(char[] self, char initialValue)
Sums the items in an array, adding the result to some initial value.static double
sum(double[] self)
Sums the items in an array.static double
sum(double[] self, double initialValue)
Sums the items in an array, adding the result to some initial value.static float
sum(float[] self)
Sums the items in an array.static float
sum(float[] self, float initialValue)
Sums the items in an array, adding the result to some initial value.static int
sum(int[] self)
Sums the items in an array.static int
sum(int[] self, int initialValue)
Sums the items in an array, adding the result to some initial value.static long
sum(long[] self)
Sums the items in an array.static long
sum(long[] self, long initialValue)
Sums the items in an array, adding the result to some initial value.static short
sum(short[] self)
Sums the items in an array.static short
sum(short[] self, short initialValue)
Sums the items in an array, adding the result to some initial value.static Object
sum(Iterable self)
Sums the items in an Iterable.static <T> Object
sum(Iterable<T> self, Closure closure)
Sums the result of apply a closure to each item of an Iterable.static <T> Object
sum(Iterable<T> self, Object initialValue, Closure closure)
Sums the result of applying a closure to each item of an Iterable to some initial value.static Object
sum(Iterable self, Object initialValue)
Sums the items in an Iterable, adding the result to some initial value.static Object
sum(Object[] self)
Sums the items in an array.static Object
sum(Object[] self, Object initialValue)
Sums the items in an array, adding the result to some initial value.static Object
sum(Collection self)
Deprecated.Use the Iterable version of sum insteadstatic Object
sum(Collection self, Closure closure)
Deprecated.Use the Iterable version of sum insteadstatic Object
sum(Collection self, Object initialValue)
Deprecated.Use the Iterable version of sum insteadstatic Object
sum(Collection self, Object initialValue, Closure closure)
Deprecated.Use the Iterable version of sum insteadstatic Object
sum(Iterator<Object> self)
Sums the items from an Iterator.static Object
sum(Iterator<Object> self, Object initialValue)
Sums the items from an Iterator, adding the result to some initial value.static <T> Object
sum(Iterator<T> self, Closure closure)
Sums the result of apply a closure to each item returned from an iterator.static <T> Object
sum(Iterator<T> self, Object initialValue, Closure closure)
Sums the result of applying a closure to each item of an Iterator to some initial value.static <T> Object
sum(T[] self, Closure closure)
Sums the result of apply a closure to each item of an array.static <T> Object
sum(T[] self, Object initialValue, Closure closure)
Sums the result of applying a closure to each item of an array to some initial value.static boolean[]
swap(boolean[] self, int i, int j)
Swaps two elements at the specified positions.static byte[]
swap(byte[] self, int i, int j)
Swaps two elements at the specified positions.static char[]
swap(char[] self, int i, int j)
Swaps two elements at the specified positions.static double[]
swap(double[] self, int i, int j)
Swaps two elements at the specified positions.static float[]
swap(float[] self, int i, int j)
Swaps two elements at the specified positions.static int[]
swap(int[] self, int i, int j)
Swaps two elements at the specified positions.static long[]
swap(long[] self, int i, int j)
Swaps two elements at the specified positions.static short[]
swap(short[] self, int i, int j)
Swaps two elements at the specified positions.static <T> List<T>
swap(List<T> self, int i, int j)
Swaps two elements at the specified positions.static <T> T[]
swap(T[] self, int i, int j)
Swaps two elements at the specified positions.static <T> Collection<T>
tail(Iterable<T> self)
Returns the items from the Iterable excluding the first item.static <T> Iterator<T>
tail(Iterator<T> self)
Returns the original iterator after throwing away the first element.static <T> List<T>
tail(List<T> self)
Returns the items from the List excluding the first item.static <T> SortedSet<T>
tail(SortedSet<T> self)
Returns the items from the SortedSet excluding the first item.static <T> T[]
tail(T[] self)
Returns the items from the array excluding the first item.static <T> List<List<T>>
tails(Iterable<T> 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.static CharSequence
take(CharSequence self, int num)
Deprecated.static <T> Collection<T>
take(Iterable<T> self, int num)
Returns the firstnum
elements from the head of this Iterable.static <T> Iterator<T>
take(Iterator<T> self, int num)
Returns an iterator of up to the firstnum
elements from this iterator.static <T> List<T>
take(List<T> self, int num)
Returns the firstnum
elements from the head of this List.static <K,V>
Map<K,V>take(Map<K,V> self, int num)
Returns a new map containing the firstnum
elements from the head of this map.static <T> SortedSet<T>
take(SortedSet<T> self, int num)
Returns the firstnum
elements from the head of this SortedSet.static <T> T[]
take(T[] self, int num)
Returns the firstnum
elements from the head of this array.static <T> Collection<T>
takeRight(Iterable<T> self, int num)
Returns the lastnum
elements from the tail of this Iterable.static <T> List<T>
takeRight(List<T> self, int num)
Returns the lastnum
elements from the tail of this List.static <T> SortedSet<T>
takeRight(SortedSet<T> self, int num)
Returns the lastnum
elements from the tail of this SortedSet.static <T> T[]
takeRight(T[] self, int num)
Returns the lastnum
elements from the tail of this array.static <T> Collection<T>
takeWhile(Iterable<T> self, Closure 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.static <T> Iterator<T>
takeWhile(Iterator<T> self, Closure condition)
Returns the longest prefix of elements in this iterator where each element passed to the given condition closure evaluates to true.static <T> List<T>
takeWhile(List<T> self, Closure condition)
Returns the longest prefix of this list where each element passed to the given closure condition evaluates to true.static <K,V>
Map<K,V>takeWhile(Map<K,V> self, Closure condition)
Returns the longest prefix of this Map where each entry (or key/value pair) when passed to the given closure evaluates to true.static <T> SortedSet<T>
takeWhile(SortedSet<T> self, Closure condition)
Returns the longest prefix of this SortedSet where each element passed to the given closure condition evaluates to true.static <T> T[]
takeWhile(T[] self, Closure condition)
Returns the longest prefix of this array where each element passed to the given closure evaluates to true.static <T,U>
Utap(U self, Closure<T> closure)
Allows the closure to be called for the object reference self (similar towith
and always returns self.static void
times(Number self, Closure closure)
Executes the closure this many times, starting from zero.static String
toArrayString(Object[] self)
Returns the string representation of the given array.static BigDecimal
toBigDecimal(CharSequence self)
Deprecated.static BigDecimal
toBigDecimal(Number self)
Transform a Number into a BigDecimalstatic BigDecimal
toBigDecimal(String self)
Deprecated.static BigInteger
toBigInteger(CharSequence self)
Deprecated.static BigInteger
toBigInteger(Number self)
Transform this Number into a BigInteger.static BigInteger
toBigInteger(String self)
Deprecated.static Boolean
toBoolean(Boolean self)
Identity conversion which returns Boolean.TRUE for a true Boolean and Boolean.FALSE for a false Boolean.static Boolean
toBoolean(String self)
Deprecated.static Character
toCharacter(String self)
Deprecated.static Double
toDouble(CharSequence self)
Deprecated.static Double
toDouble(Number self)
Transform a Number into a Doublestatic Double
toDouble(String self)
Deprecated.static Float
toFloat(CharSequence self)
Deprecated.static Float
toFloat(Number self)
Transform a Number into a Floatstatic Float
toFloat(String self)
Deprecated.static Integer
toInteger(CharSequence self)
Deprecated.static Integer
toInteger(Number self)
Transform a Number into an Integerstatic Integer
toInteger(String self)
Deprecated.static List<String>
tokenize(CharSequence self)
Deprecated.static List<String>
tokenize(CharSequence self, Character token)
Deprecated.static List<String>
tokenize(CharSequence self, CharSequence token)
Deprecated.static List<String>
tokenize(String self)
Deprecated.static List<String>
tokenize(String self, Character token)
Deprecated.static List<String>
tokenize(String self, String token)
Deprecated.static List<Boolean>
toList(boolean[] array)
Converts this array to a List of the same size, with each element added to the list.static List<Byte>
toList(byte[] array)
Converts this array to a List of the same size, with each element added to the list.static List<Character>
toList(char[] array)
Converts this array to a List of the same size, with each element added to the list.static List<Double>
toList(double[] array)
Converts this array to a List of the same size, with each element added to the list.static List<Float>
toList(float[] array)
Converts this array to a List of the same size, with each element added to the list.static List<Integer>
toList(int[] array)
Converts this array to a List of the same size, with each element added to the list.static List<Long>
toList(long[] array)
Converts this array to a List of the same size, with each element added to the list.static List<Short>
toList(short[] array)
Converts this array to a List of the same size, with each element added to the list.static List<String>
toList(CharSequence self)
Deprecated.static <T> List<T>
toList(Iterable<T> self)
Convert an Iterable to a List.static List<String>
toList(String self)
Deprecated.static <T> List<T>
toList(Collection<T> self)
Deprecated.Use the Iterable version of toList insteadstatic <T> List<T>
toList(Enumeration<T> self)
Convert an enumeration to a List.static <T> List<T>
toList(Iterator<T> self)
Convert an iterator to a List.static <T> List<T>
toList(T[] array)
Allows conversion of arrays into a mutable List.static String
toListString(Collection self)
Returns the string representation of the given list.static String
toListString(Collection self, int maxSize)
Returns the string representation of the given list.static Long
toLong(CharSequence self)
Deprecated.static Long
toLong(Number self)
Transform a Number into a Longstatic Long
toLong(String self)
Deprecated.static char
toLowerCase(Character self)
Converts the character to lowercase.static String
toMapString(Map self)
Returns the string representation of this map.static String
toMapString(Map self, int maxSize)
Returns the string representation of this map.static Set<Boolean>
toSet(boolean[] array)
Converts this array to a Set, with each unique element added to the set.static Set<Byte>
toSet(byte[] array)
Converts this array to a Set, with each unique element added to the set.static Set<Character>
toSet(char[] array)
Converts this array to a Set, with each unique element added to the set.static Set<Double>
toSet(double[] array)
Converts this array to a Set, with each unique element added to the set.static Set<Float>
toSet(float[] array)
Converts this array to a Set, with each unique element added to the set.static Set<Integer>
toSet(int[] array)
Converts this array to a Set, with each unique element added to the set.static Set<Long>
toSet(long[] array)
Converts this array to a Set, with each unique element added to the set.static Set<Short>
toSet(short[] array)
Converts this array to a Set, with each unique element added to the set.static Set<String>
toSet(CharSequence self)
Deprecated.static <T> Set<T>
toSet(Iterable<T> self)
Convert an Iterable to a Set.static Set<String>
toSet(String self)
Deprecated.static <T> Set<T>
toSet(Collection<T> self)
Convert a Collection to a Set.static <T> Set<T>
toSet(Enumeration<T> self)
Convert an enumeration to a Set.static <T> Set<T>
toSet(Iterator<T> self)
Convert an iterator to a Set.static Short
toShort(CharSequence self)
Deprecated.static Short
toShort(String self)
Deprecated.static <T> List<T>
toSorted(Iterable<T> self)
Sorts the Iterable.static <T> List<T>
toSorted(Iterable<T> self, Closure closure)
Sorts this Iterable using the given Closure to determine the correct ordering.static <T> List<T>
toSorted(Iterable<T> self, Comparator<T> comparator)
Sorts the Iterable using the given Comparator.static <T> Iterator<T>
toSorted(Iterator<T> self)
Sorts the Iterator.static <T> Iterator<T>
toSorted(Iterator<T> self, Closure closure)
Sorts the given iterator items into a sorted iterator using the Closure to determine the correct ordering.static <T> Iterator<T>
toSorted(Iterator<T> self, Comparator<T> comparator)
Sorts the given iterator items using the comparator.static <K,V>
Map<K,V>toSorted(Map<K,V> self)
Sorts the elements from the given map into a new ordered map using aNumberAwareComparator
on map entry values to determine the resulting order.static <K,V>
Map<K,V>toSorted(Map<K,V> self, Closure 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.static <K,V>
Map<K,V>toSorted(Map<K,V> self, Comparator<Map.Entry<K,V>> comparator)
Sorts the elements from the given map into a new ordered map using the supplied comparator to determine the ordering.static <K,V>
Map<K,V>toSorted(SortedMap<K,V> self)
Avoids doing unnecessary work when sorting an already sorted mapstatic <T> Set<T>
toSorted(SortedSet<T> self)
Avoids doing unnecessary work when sorting an already sorted setstatic <T> T[]
toSorted(T[] self)
Returns a sorted version of the given array using the supplied comparator.static <T> T[]
toSorted(T[] self, Closure condition)
Sorts the elements from this array into a newly created array using the Closure to determine the correct ordering.static <T> T[]
toSorted(T[] self, Comparator<T> comparator)
Returns a sorted version of the given array using the supplied comparator to determine the resulting order.static SpreadMap
toSpreadMap(Iterable self)
Creates a spreadable map from this iterable.static SpreadMap
toSpreadMap(Object[] self)
Creates a spreadable map from this array.static SpreadMap
toSpreadMap(List self)
Creates a spreadable map from this list.static SpreadMap
toSpreadMap(Map self)
Returns a newSpreadMap
from this map.static String
toString(boolean[] self)
Returns the string representation of the given array.static String
toString(byte[] self)
Returns the string representation of the given array.static String
toString(char[] self)
Returns the string representation of the given array.static String
toString(double[] self)
Returns the string representation of the given array.static String
toString(float[] self)
Returns the string representation of the given array.static String
toString(int[] self)
Returns the string representation of the given array.static String
toString(long[] self)
Returns the string representation of the given array.static String
toString(short[] self)
Returns the string representation of the given array.static String
toString(Object value)
Create a String representation of this object.static String
toString(Object[] self)
Returns the string representation of this array's contents.static String
toString(AbstractCollection self)
Returns the string representation of the given collection.static String
toString(AbstractMap self)
Returns the string representation of the given map.static <T> Collection<T>
toUnique(Iterable<T> self)
Returns a Collection containing the items from the Iterable but with duplicates removed using the natural ordering of the items to determine uniqueness.static <T> Collection<T>
toUnique(Iterable<T> self, Closure condition)
Returns a Collection containing the items from the Iterable but with duplicates removed.static <T> Collection<T>
toUnique(Iterable<T> self, Comparator<T> comparator)
Returns a Collection containing the items from the Iterable but with duplicates removed.static <T> Iterator<T>
toUnique(Iterator<T> self)
Returns an iterator equivalent to this iterator with all duplicated items removed by using the natural ordering of the items.static <T> Iterator<T>
toUnique(Iterator<T> self, Closure 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.static <T> Iterator<T>
toUnique(Iterator<T> self, Comparator<T> comparator)
Returns an iterator equivalent to this iterator with all duplicated items removed by using the supplied comparator.static <T> List<T>
toUnique(List<T> self)
Returns a List containing the items from the List but with duplicates removed using the natural ordering of the items to determine uniqueness.static <T> List<T>
toUnique(List<T> self, Closure condition)
Returns a List containing the items from the List but with duplicates removed.static <T> List<T>
toUnique(List<T> self, Comparator<T> comparator)
Returns a List containing the items from the List but with duplicates removed.static <T> T[]
toUnique(T[] 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.static <T> T[]
toUnique(T[] self, Closure 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.static <T> T[]
toUnique(T[] self, Comparator<T> 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.static char
toUpperCase(Character self)
Converts the character to uppercase.static URI
toURI(CharSequence self)
Deprecated.static URI
toURI(String self)
Deprecated.static URL
toURL(CharSequence self)
Deprecated.static URL
toURL(String self)
Deprecated.static CharSequence
tr(CharSequence self, CharSequence sourceSet, CharSequence replacementSet)
Deprecated.static String
tr(String self, String sourceSet, String replacementSet)
Deprecated.static void
transformChar(Reader self, Writer writer, Closure closure)
Deprecated.static void
transformLine(Reader reader, Writer writer, Closure closure)
Deprecated.static List
transpose(List self)
Adds GroovyCollections#transpose(List) as a method on lists.static void
traverse(File self, Closure closure)
Deprecated.static void
traverse(File self, Map<String,Object> options)
Deprecated.static void
traverse(File self, Map<String,Object> options, Closure closure)
Deprecated.static double
trunc(Double number)
Truncate the valuestatic double
trunc(Double number, int precision)
Truncate the valuestatic float
trunc(Float number)
Truncate the valuestatic float
trunc(Float number, int precision)
Truncate the valuestatic BigDecimal
trunc(BigDecimal number)
Truncate the valuestatic BigDecimal
trunc(BigDecimal number, int precision)
Truncate the valuestatic Number
unaryMinus(Number left)
Negates the number.static Number
unaryPlus(Number left)
Returns the number, effectively being a noop for numbers.static CharSequence
unexpand(CharSequence self)
Deprecated.static CharSequence
unexpand(CharSequence self, int tabStop)
Deprecated.static String
unexpand(String self)
Deprecated.static String
unexpand(String self, int tabStop)
Deprecated.static CharSequence
unexpandLine(CharSequence self, int tabStop)
Deprecated.static String
unexpandLine(String self, int tabStop)
Deprecated.static <T> Collection<T>
unique(Collection<T> self)
Modifies this collection to remove all duplicated items, using Groovy's default number-aware comparator.static <T> Collection<T>
unique(Collection<T> self, boolean mutate)
Remove all duplicates from a given Collection using Groovy's default number-aware comparator.static <T> Collection<T>
unique(Collection<T> self, boolean mutate, Closure closure)
A convenience method for making a collection unique using a Closure to determine duplicate (equal) items.static <T> Collection<T>
unique(Collection<T> self, boolean mutate, Comparator<T> comparator)
Remove all duplicates from a given Collection.static <T> Collection<T>
unique(Collection<T> self, Closure closure)
A convenience method for making a collection unique using a Closure to determine duplicate (equal) items.static <T> Collection<T>
unique(Collection<T> self, Comparator<T> comparator)
Remove all duplicates from a given Collection.static <T> Iterator<T>
unique(Iterator<T> self)
Returns an iterator equivalent to this iterator with all duplicated items removed by using Groovy's default number-aware comparator.static <T> Iterator<T>
unique(Iterator<T> self, Closure condition)
Returns an iterator equivalent to this iterator but with all duplicated items removed by using a Closure to determine duplicate (equal) items.static <T> Iterator<T>
unique(Iterator<T> self, Comparator<T> comparator)
Returns an iterator equivalent to this iterator with all duplicated items removed by using the supplied comparator.static <T> List<T>
unique(List<T> self)
Modifies this List to remove all duplicated items, using Groovy's default number-aware comparator.static <T> List<T>
unique(List<T> self, boolean mutate)
Remove all duplicates from a given List using Groovy's default number-aware comparator.static <T> List<T>
unique(List<T> self, boolean mutate, Closure closure)
A convenience method for making a List unique using a Closure to determine duplicate (equal) items.static <T> List<T>
unique(List<T> self, boolean mutate, Comparator<T> comparator)
Remove all duplicates from a given List.static <T> List<T>
unique(List<T> self, Closure closure)
A convenience method for making a List unique using a Closure to determine duplicate (equal) items.static <T> List<T>
unique(List<T> self, Comparator<T> comparator)
Remove all duplicates from a given List.static void
upto(double self, Number to, Closure closure)
Iterates from this number up to the given number, inclusive, incrementing by one each time.static void
upto(float self, Number to, Closure closure)
Iterates from this number up to the given number, inclusive, incrementing by one each time.static void
upto(long self, Number to, Closure closure)
Iterates from this number up to the given number, inclusive, incrementing by one each time.static void
upto(Double self, Number to, Closure closure)
Iterates from this number up to the given number, inclusive, incrementing by one each time.static void
upto(Float self, Number to, Closure closure)
Iterates from this number up to the given number, inclusive, incrementing by one each time.static void
upto(Long self, Number to, Closure closure)
Iterates from this number up to the given number, inclusive, incrementing by one each time.static void
upto(Number self, Number to, Closure closure)
Iterates from this number up to the given number, inclusive, incrementing by one each time.static void
upto(BigDecimal self, Number to, Closure closure)
Iterates from this number up to the given number, inclusive, incrementing by one each time.static void
upto(BigInteger self, Number to, Closure closure)
Iterates from this number up to the given number, inclusive, incrementing by one each time.static <T> T
use(Object self, Class categoryClass, Closure<T> closure)
Scoped use methodstatic Object
use(Object self, Object[] array)
Allows you to use a list of categories, specifying the list as varargs.static <T> T
use(Object self, List<Class> categoryClassList, Closure<T> closure)
Scoped use method with list of categories.static <T,U extends T,V extends T>
Twith(U self, boolean returning, Closure<T> closure)
Allows the closure to be called for the object reference self.static <T,U>
Twith(U self, Closure<T> closure)
Allows the closure to be called for the object reference self.static <T> T
withDataInputStream(File file, Closure<T> closure)
Deprecated.static <T> T
withDataOutputStream(File file, Closure<T> closure)
Deprecated.static <T> ListWithDefault<T>
withDefault(List<T> self, Closure<T> init)
An alias forwithLazyDefault
which decorates a list allowing it to grow when called with index values outside the normal list bounds.static <K,V>
Map<K,V>withDefault(Map<K,V> self, Closure<V> init)
Wraps a map using the decorator pattern with a wrapper that intercepts all calls toget(key)
.static <T> List<T>
withDefault$$bridge(List<T> self, Closure<T> init)
Deprecated.static <T> ListWithDefault<T>
withEagerDefault(List<T> self, Closure<T> init)
Decorates a list allowing it to grow when called with a non-existent index value.static <T> List<T>
withEagerDefault$$bridge(List<T> self, Closure<T> init)
Deprecated.static <E> List<Tuple2<E,Integer>>
withIndex(Iterable<E> self)
Zips an Iterable with indices in (value, index) order.static <E> List<Tuple2<E,Integer>>
withIndex(Iterable<E> self, int offset)
Zips an Iterable with indices in (value, index) order.static <E> Iterator<Tuple2<E,Integer>>
withIndex(Iterator<E> self)
Zips an iterator with indices in (value, index) order.static <E> Iterator<Tuple2<E,Integer>>
withIndex(Iterator<E> self, int offset)
Zips an iterator with indices in (value, index) order.static Object
withInputStream(File file, Closure closure)
Deprecated.static <T> T
withInputStream(URL url, Closure<T> closure)
Deprecated.static <T> ListWithDefault<T>
withLazyDefault(List<T> self, Closure<T> init)
Decorates a list allowing it to grow when called with a non-existent index value.static <T> List<T>
withLazyDefault$$bridge(List<T> self, Closure<T> init)
Deprecated.static <T> T
withObjectInputStream(File file, Closure<T> closure)
Deprecated.static <T> T
withObjectInputStream(File file, ClassLoader classLoader, Closure<T> closure)
Deprecated.static <T> T
withObjectInputStream(InputStream inputStream, Closure<T> closure)
Deprecated.static <T> T
withObjectInputStream(InputStream inputStream, ClassLoader classLoader, Closure<T> closure)
Deprecated.static <T> T
withObjectOutputStream(File file, Closure<T> closure)
Deprecated.static <T> T
withObjectOutputStream(OutputStream outputStream, Closure<T> closure)
Deprecated.static <T> T
withObjectStreams(Socket socket, Closure<T> closure)
Deprecated.static Object
withOutputStream(File file, Closure closure)
Deprecated.static <T> T
withPrintWriter(File file, Closure<T> closure)
Deprecated.static <T> T
withPrintWriter(File file, String charset, Closure<T> closure)
Deprecated.static <T> T
withPrintWriter(Writer writer, Closure<T> closure)
Deprecated.static <T> T
withReader(File file, Closure<T> closure)
Deprecated.static <T> T
withReader(File file, String charset, Closure<T> closure)
Deprecated.static <T> T
withReader(InputStream in, Closure<T> closure)
Deprecated.static <T> T
withReader(InputStream in, String charset, Closure<T> closure)
Deprecated.static <T> T
withReader(Reader reader, Closure<T> closure)
Deprecated.static <T> T
withReader(URL url, Closure<T> closure)
Deprecated.static <T> T
withReader(URL url, String charset, Closure<T> closure)
Deprecated.static <T> T
withStream(InputStream stream, Closure<T> closure)
Deprecated.static <T> T
withStream(OutputStream os, Closure<T> closure)
Deprecated.static <T> T
withStreams(Socket socket, Closure<T> closure)
Deprecated.static Object
withTraits(Object self, Class<?>... traits)
Dynamically wraps an instance into something which implements the supplied trait classes.static <T> T
withWriter(File file, Closure<T> closure)
Deprecated.static <T> T
withWriter(File file, String charset, Closure<T> closure)
Deprecated.static <T> T
withWriter(OutputStream stream, Closure<T> closure)
Deprecated.static <T> T
withWriter(OutputStream stream, String charset, Closure<T> closure)
Deprecated.static <T> T
withWriter(Writer writer, Closure<T> closure)
Deprecated.static <T> T
withWriterAppend(File file, Closure<T> closure)
Deprecated.static <T> T
withWriterAppend(File file, String charset, Closure<T> closure)
Deprecated.static void
write(File file, String text)
Deprecated.static void
write(File file, String text, String charset)
Deprecated.static void
write(Writer self, Writable writable)
Deprecated.static void
writeLine(BufferedWriter writer, String line)
Deprecated.static Boolean
xor(Boolean left, Boolean right)
Exclusive disjunction of two boolean operatorsstatic Number
xor(Number left, Number right)
Bitwise XOR together two Numbers.static BitSet
xor(BitSet left, BitSet right)
Bitwise XOR together two BitSets.-
Methods inherited from class org.codehaus.groovy.runtime.DefaultGroovyMethodsSupport
cloneSimilarCollection, cloneSimilarMap, closeQuietly, closeWithWarning, createSimilarArray, createSimilarCollection, createSimilarCollection, createSimilarCollection, createSimilarList, createSimilarMap, createSimilarOrDefaultCollection, createSimilarQueue, createSimilarSet, normaliseIndex, sameType, subListBorders, subListBorders
-
-
-
-
Method Detail
-
is
public static boolean is(Object self, Object other)
Identity check. Since == is overridden in Groovy with the meaning of equality we need some fallback to check for object identity. Invoke using the 'is' method, like so:def same = this.is(that)
- Parameters:
self
- an objectother
- an object to compare identity with- Returns:
- true if self and other are both references to the same instance, false otherwise
- Since:
- 1.0
-
identity
public static <T,U> T identity(U self, @DelegatesTo(value=Target.class,target="self",strategy=1) Closure<T> closure)
Allows the closure to be called for the object reference self. Synonym for 'with()'.- Parameters:
self
- the object to have a closure act uponclosure
- the closure to call on the object- Returns:
- result of calling the closure
- Since:
- 1.0
- See Also:
with(Object, Closure)
-
with
public static <T,U> T with(U self, @DelegatesTo(value=Target.class,target="self",strategy=1) Closure<T> closure)
Allows the closure to be called for the object reference self.Any method invoked inside the closure will first be invoked on the self reference. For instance, the following method calls to the append() method are invoked on the StringBuilder instance:
def b = new StringBuilder().with { append('foo') append('bar') return it } assert b.toString() == 'foobar'
This is commonly used to simplify object creation, such as this example:def p = new Person().with { firstName = 'John' lastName = 'Doe' return it }
The other typical usage, uses the self object while creating some value:def fullName = person.with{ "$firstName $lastName" }
- Parameters:
self
- the object to have a closure act uponclosure
- the closure to call on the object- Returns:
- result of calling the closure
- Since:
- 1.5.0
- See Also:
with(Object, boolean, Closure)
,tap(Object, Closure)
-
with
public static <T,U extends T,V extends T> T with(U self, boolean returning, @DelegatesTo(value=Target.class,target="self",strategy=1) Closure<T> closure)
Allows the closure to be called for the object reference self. Any method invoked inside the closure will first be invoked on the self reference. For example, the following method calls to the append() method are invoked on the StringBuilder instance and then, because 'returning' is true, the self instance is returned:def b = new StringBuilder().with(true) { append('foo') append('bar') } assert b.toString() == 'foobar'
The returning parameter is commonly set to true when using with to simplify object creation, such as this example:def p = new Person().with(true) { firstName = 'John' lastName = 'Doe' }
Alternatively, 'tap' is an alias for 'with(true)', so that method can be used instead. The other main use case for with is when returning a value calculated using self as shown here:def fullName = person.with(false){ "$firstName $lastName" }
Alternatively, 'with' is an alias for 'with(false)', so the boolean parameter can be ommitted instead.- Parameters:
self
- the object to have a closure act uponreturning
- if true, return the self object; otherwise, the result of calling the closureclosure
- the closure to call on the object- Returns:
- the self object or the result of calling the closure depending on 'returning'
- Since:
- 2.5.0
- See Also:
with(Object, Closure)
,tap(Object, Closure)
<
-
-