Groovy 2.1.9

org.codehaus.groovy.runtime
[Java] 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 a reverse() method for String.

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

Authors:
James Strachan
Jeremy Rayner
Sam Pullara
Rod Cope
Guillaume Laforge
John Wilson
Hein Meling
Dierk Koenig
Pilho Kim
Marc Guillemot
Russel Winder
bing ran
Jochen Theodorou
Paul King
Michael Baehr
Joachim Baumann
Alex Tkachman
Ted Naleid
Brad Long
Jim Jagielski
Rodolfo Velasco
jeremi Joslin
Hamlet D'Arcy
Cedric Champeau
Tim Yates
Dinko Srkoc
Andre Steingress


Field Summary
static Class[] DGM_LIKE_CLASSES

static Class[] additionals

 
Method Summary
static int abs(Number number)

Truncate the value

static long abs(Long number)

Truncate the value

static float abs(Float number)

Determine if a Character is uppercase.

static double abs(Double number)

static Socket accept(ServerSocket serverSocket, Closure closure)

static Socket accept(ServerSocket serverSocket, boolean runInANewThread, Closure closure)

static boolean addAll(Collection self, Object[] items)

static boolean addAll(List self, int index, Object[] items)

Splits all items into two lists based on the closure condition.

static void addShutdownHook(Object self, Closure closure)

static Number and(Number left, Number right)

static BitSet and(BitSet left, BitSet right)

static Boolean and(Boolean left, Boolean right)

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

static boolean any(Object self, Closure closure)

static boolean any(Map self, Closure closure)

static boolean any(Object self)

static void append(File file, Object text)

static void append(File file, byte[] bytes)

static void append(File self, InputStream stream)

static void append(File file, Object text, String charset)

static boolean asBoolean(Object object)

Coerce a collection instance to a boolean value.

static boolean asBoolean(Boolean bool)

static boolean asBoolean(Collection collection)

Coerce an iterator instance to a boolean value.

static boolean asBoolean(Map map)

Coerce an enumeration instance to a boolean value.

static boolean asBoolean(Iterator iterator)

Coerce an Object array to a boolean value.

static boolean asBoolean(Enumeration enumeration)

Coerces a byte array to a boolean value.

static boolean asBoolean(Object[] array)

Coerces a short array to a boolean value.

static boolean asBoolean(byte[] array)

Coerces an int array to a boolean value.

static boolean asBoolean(short[] array)

Coerces a long array to a boolean value.

static boolean asBoolean(int[] array)

Coerces a float array to a boolean value.

static boolean asBoolean(long[] array)

Coerces a double array to a boolean value.

static boolean asBoolean(float[] array)

Coerces a boolean array to a boolean value.

static boolean asBoolean(double[] array)

Coerces a char array to a boolean value.

static boolean asBoolean(boolean[] array)

Coerce a character to a boolean value.

static boolean asBoolean(char[] array)

Coerce a number to a boolean value.

static boolean asBoolean(Character character)

static boolean asBoolean(Number number)

static boolean asBoolean(CharSequence string)

static boolean asBoolean(Matcher matcher)

static Map asImmutable(Map self)

A convenience method for creating an immutable sorted map.

static SortedMap asImmutable(SortedMap self)

static List asImmutable(List self)

static Set asImmutable(Set self)

static SortedSet asImmutable(SortedSet self)

static Collection asImmutable(Collection self)

A convenience method for creating a synchronized SortedMap.

static List asList(Collection self)

Coerce an object instance to a boolean value.

static Map asSynchronized(Map self)

static SortedMap asSynchronized(SortedMap self)

static Collection asSynchronized(Collection self)

static List asSynchronized(List self)

static Set asSynchronized(Set self)

static SortedSet asSynchronized(SortedSet self)

static Object asType(Collection col, Class clazz)

static Object asType(Object[] ary, Class clazz)

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

static Object asType(Closure cl, Class clazz)

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

static Object asType(Map map, Class clazz)

static Object asType(Number self, Class c)

Traverse through each byte of this Byte array.

static Object asType(Object obj, Class type)

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

static Object asType(CharSequence self, Class c)

static Object asType(GString self, Class c)

static Object asType(String self, Class c)

static Object asType(File f, Class c)

static File asWritable(File file)

static File asWritable(File file, String encoding)

static BitSet bitwiseNegate(BitSet self)

Iterates from this number up to the given number, inclusive, incrementing by one each time.

static Pattern bitwiseNegate(CharSequence self)

static Pattern bitwiseNegate(String self)

protected static Object callClosureForLine(Closure closure, String line, int counter)

protected static Object callClosureForMapEntry(Closure closure, Map.Entry entry)

protected static Object callClosureForMapEntryAndCounter(Closure closure, Map.Entry entry, int counter)

static CharSequence capitalize(CharSequence self)

static String capitalize(String self)

static CharSequence center(CharSequence self, Number numberOfChars)

static CharSequence center(CharSequence self, Number numberOfChars, CharSequence padding)

static String center(String self, Number numberOfChars)

static String center(String self, Number numberOfChars, String padding)

static List collate(List self, int size)

static List collate(List self, int size, int step)

static List collate(List self, int size, boolean keepRemainder)

static List collate(List self, int size, int step, boolean keepRemainder)

static List collect(Object self, Closure transform)

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

static Collection collect(Object self)

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

static Collection collect(Object self, Collection collector, Closure transform)

static List collect(Collection self, Closure transform)

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 List collect(Collection self)

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

static Collection collect(Collection self, Collection collector, Closure transform)

static Collection collect(Map self, Collection collector, Closure transform)

static List collect(Map self, Closure transform)

static List collectAll(Collection self, Closure transform)

static Collection collectAll(Collection self, Collection collector, Closure transform)

static Map collectEntries(Map self, Map collector, Closure transform)

static Map collectEntries(Map self, Closure transform)

static Map collectEntries(Collection self, Closure transform)

A variant of collectEntries for Iterators.

static Map collectEntries(Iterator self, Closure transform)

A variant of collectEntries for Iterables.

static Map collectEntries(Iterable self, Closure transform)

static Map collectEntries(Collection self)

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

static Map collectEntries(Iterator self)

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

static Map collectEntries(Iterable self)

static Map collectEntries(Collection self, Map collector, Closure transform)

static Map collectEntries(Iterator self, Map collector, Closure transform)

static Map collectEntries(Iterable self, Map collector, Closure transform)

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

static Map collectEntries(Collection self, Map 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 Map collectEntries(Iterator self, Map 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 Map collectEntries(Iterable self, Map collector)

static Map collectEntries(Object[] self, Map collector, Closure transform)

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

static Map collectEntries(Object[] self, Map collector)

static Map collectEntries(Object[] self, Closure transform)

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

static Map collectEntries(Object[] self)

static List collectMany(Collection self, Closure projection)

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

static Collection collectMany(Collection self, Collection collector, Closure projection)

static Collection collectMany(Map self, Collection collector, Closure projection)

static Collection collectMany(Map self, Closure projection)

static List collectMany(Object[] self, Closure projection)

static List collectMany(Iterator self, Closure projection)

static List collectNested(Collection self, Closure transform)

Deprecated alias for collectNested

static Collection collectNested(Collection self, Collection collector, Closure transform)

static List combinations(Collection self)

Finds all non-null subsequences of a list.

static int compareTo(Character left, Number right)

static int compareTo(Number left, Character right)

static int compareTo(Character left, Character right)

static int compareTo(Number left, Number right)

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)

Returns the string representation of the given array.

static boolean contains(char[] self, Object value)

Returns the string representation of the given array.

static boolean contains(boolean[] self, Object value)

Returns the string representation of the given array.

static boolean contains(double[] self, Object value)

Returns the string representation of the given array.

static boolean contains(float[] self, Object value)

static boolean contains(byte[] self, Object value)

Returns the string representation of the given array.

static boolean contains(Object[] self, Object value)

Returns the string representation of the given map.

static boolean contains(CharSequence self, CharSequence text)

static boolean contains(String self, String text)

static boolean containsAll(Collection self, Object[] items)

Modifies this collection by removing its elements that are contained within the specified object array.

static Number count(Iterator self, Object value)

static Number count(Iterator self, Closure closure)

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

static Number count(Collection self, Object value)

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

static Number count(Collection self, Closure closure)

static Number count(Map self, Closure closure)

static Number count(Object[] self, Object value)

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

static Number count(Object[] self, Closure closure)

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 Number count(char[] self, Object value)

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

static Number count(boolean[] 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(byte[] self, Object value)

static int count(CharSequence self, CharSequence text)

static int count(String self, String text)

static Map countBy(Collection self, Closure closure)

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

static Map countBy(Object[] self, Closure closure)

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

static Map countBy(Iterator self, Closure closure)

static Map countBy(Map self, Closure closure)

Groups the current element according to the value

protected static StringBufferWriter createStringBufferWriter(StringBuffer self)

protected static StringWriter createStringWriter(String self)

static boolean deleteDir(File self)

static CharSequence denormalize(CharSequence self)

static String denormalize(String self)

static boolean disjoint(Collection left, Collection right)

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

static Number div(Character left, Number right)

Bitwise AND together two Numbers.

static Number div(Number left, Character right)

Bitwise AND together two BitSets.

static Number div(Character left, Character right)

Bitwise XOR together two BitSets.

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(long self, Number to, Closure closure)

static void downto(Long self, Number to, Closure closure)

static void downto(float self, Number to, Closure closure)

static void downto(Float self, Number to, Closure closure)

static void downto(double self, Number to, Closure closure)

static void downto(Double self, Number to, Closure closure)

Iterates from this number up to the given number using a step increment.

static void downto(BigInteger self, Number to, Closure closure)

static void downto(BigDecimal self, Number to, Closure closure)

Get the absolute value

static List drop(List self, int num)

static List drop(Iterable self, int num)

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

static Object[] drop(Object[] self, int num)

static Map drop(Map self, int num)

static Iterator drop(Iterator self, int num)

Returns the longest prefix of this list where each element passed to the given closure condition evaluates to true.

static CharSequence drop(CharSequence self, int num)

static List dropWhile(List self, Closure condition)

static List dropWhile(Iterable 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 Map dropWhile(Map self, Closure condition)

static Object[] dropWhile(Object[] self, Closure condition)

static Iterator dropWhile(Iterator self, Closure condition)

static String dump(Object self)

static Object each(Object self, Closure closure)

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

static Map each(Map self, Closure closure)

static void eachByte(Byte[] self, Closure closure)

static void eachByte(byte[] self, Closure closure)

static void eachByte(File self, Closure closure)

static void eachByte(File self, int bufferLen, Closure closure)

static void eachByte(InputStream is, Closure closure)

static void eachByte(InputStream is, int bufferLen, Closure closure)

static void eachByte(URL url, Closure closure)

static void eachByte(URL url, int bufferLen, Closure closure)

static void eachDir(File self, Closure closure)

static void eachDirMatch(File self, Object nameFilter, Closure closure)

static void eachDirRecurse(File self, Closure closure)

static void eachFile(File self, FileType fileType, Closure closure)

static void eachFile(File self, Closure closure)

static void eachFileMatch(File self, FileType fileType, Object nameFilter, Closure closure)

static void eachFileMatch(File self, Object nameFilter, Closure closure)

static void eachFileRecurse(File self, FileType fileType, Closure closure)

static void eachFileRecurse(File self, Closure closure)

static Object eachLine(CharSequence self, Closure closure)

static Object eachLine(CharSequence self, int firstLine, Closure closure)

static Object eachLine(String self, Closure closure)

static Object eachLine(String self, int firstLine, Closure closure)

static Object eachLine(File self, Closure closure)

static Object eachLine(File self, String charset, Closure closure)

static Object eachLine(File self, int firstLine, Closure closure)

static Object eachLine(File self, String charset, int firstLine, Closure closure)

static Object eachLine(InputStream stream, String charset, Closure closure)

static Object eachLine(InputStream stream, String charset, int firstLine, Closure closure)

static Object eachLine(InputStream stream, Closure closure)

static Object eachLine(InputStream stream, int firstLine, Closure closure)

static Object eachLine(URL url, Closure closure)

static Object eachLine(URL url, int firstLine, Closure closure)

static Object eachLine(URL url, String charset, Closure closure)

static Object eachLine(URL url, String charset, int firstLine, Closure closure)

static Object eachLine(Reader self, Closure closure)

static Object eachLine(Reader self, int firstLine, Closure closure)

static String eachMatch(CharSequence self, CharSequence regex, Closure closure)

static String eachMatch(CharSequence self, Pattern pattern, Closure closure)

static String eachMatch(String self, Pattern pattern, Closure closure)

static String eachMatch(String self, String regex, Closure closure)

static void eachObject(File self, Closure closure)

static void eachObject(ObjectInputStream ois, Closure closure)

static Iterator eachPermutation(Collection self, Closure closure)

static Object eachWithIndex(Object self, Closure closure)

static Map eachWithIndex(Map self, Closure closure)

static boolean equals(int[] left, int[] right)

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

static boolean equals(Object[] left, List right)

static boolean equals(List left, Object[] right)

static boolean equals(List left, List right)

static boolean equals(Set self, Set other)

static boolean equals(Map self, Map other)

Create a Set composed of the elements of the first Set minus the elements of the given Collection.

static boolean every(Object self, Closure closure)

static boolean every(Map self, Closure closure)

static boolean every(Object self)

static Process execute(String self)

static Process execute(String self, String[] envp, File dir)

static Process execute(String self, List envp, File dir)

static Process execute(String[] commandArray)

static Process execute(String[] commandArray, String[] envp, File dir)

static Process execute(String[] commandArray, List envp, File dir)

static Process execute(List commands)

static Process execute(List commands, String[] envp, File dir)

static Process execute(List commands, List envp, File dir)

static CharSequence expand(CharSequence self)

static CharSequence expand(CharSequence self, int tabStop)

static String expand(String self)

static String expand(String self, int tabStop)

static CharSequence expandLine(CharSequence self, int tabStop)

static String expandLine(String self, int tabStop)

static void filterLine(Reader reader, Writer writer, Closure closure)

static Writable filterLine(File self, Closure closure)

static Writable filterLine(File self, String charset, Closure closure)

static void filterLine(File self, Writer writer, Closure closure)

static void filterLine(File self, Writer writer, String charset, Closure closure)

static Writable filterLine(Reader reader, Closure closure)

static Writable filterLine(InputStream self, Closure predicate)

static Writable filterLine(InputStream self, String charset, Closure predicate)

static void filterLine(InputStream self, Writer writer, Closure predicate)

static void filterLine(InputStream self, Writer writer, String charset, Closure predicate)

static Writable filterLine(URL self, Closure predicate)

static Writable filterLine(URL self, String charset, Closure predicate)

static void filterLine(URL self, Writer writer, Closure predicate)

static void filterLine(URL self, Writer writer, String charset, Closure predicate)

static Object find(Object self, Closure closure)

static Object find(Object self)

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 Object find(Collection self, Closure closure)

static Object find(Object[] self, Closure condition)

static Object find(Collection self)

static Map.Entry find(Map self, Closure closure)

static CharSequence find(CharSequence self, CharSequence regex)

static CharSequence find(CharSequence self, CharSequence regex, Closure closure)

static CharSequence find(CharSequence self, Pattern pattern)

static CharSequence find(CharSequence self, Pattern pattern, Closure closure)

static String find(String self, Pattern pattern)

static String find(String self, Pattern pattern, Closure closure)

static String find(String self, String regex)

static String find(String self, String regex, Closure closure)

static Collection findAll(Collection self, Closure closure)

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

static Collection findAll(Object[] self, Closure condition)

static Collection findAll(Collection self)

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

static Collection findAll(Object[] self)

Finds all items matching the closure condition.

static Collection findAll(Object self, Closure closure)

static Collection findAll(Object self)

static Map findAll(Map self, Closure closure)

static List findAll(CharSequence self, CharSequence regex)

static List findAll(CharSequence self, CharSequence regex, Closure closure)

static List findAll(CharSequence self, Pattern pattern)

static List findAll(CharSequence self, Pattern pattern, Closure closure)

static List findAll(String self, Pattern pattern)

static List findAll(String self, Pattern pattern, Closure closure)

static List findAll(String self, String regex)

static List findAll(String self, String regex, Closure closure)

static int findIndexOf(Object self, Closure closure)

static int findIndexOf(Object self, int startIndex, Closure closure)

static List findIndexValues(Object self, Closure closure)

static List findIndexValues(Object self, Number startIndex, Closure closure)

static int findLastIndexOf(Object self, Closure closure)

Converts a given object to a type.

static int findLastIndexOf(Object self, int startIndex, Closure closure)

static Object findResult(Object self, Object defaultResult, Closure closure)

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, Closure closure)

static Object findResult(Collection self, Object defaultResult, Closure closure)

static Object findResult(Collection self, Closure closure)

static Object findResult(Map self, Object defaultResult, Closure closure)

static Object findResult(Map self, Closure closure)

static Collection findResults(Collection self, Closure filteringTransform)

static Collection findResults(Map self, Closure filteringTransform)

static Object first(List self)

static Object first(Iterable self)

Returns the first item from the array.

static Object first(Object[] self)

static Collection flatten(Collection self)

Flatten an array.

static Collection flatten(Object[] self)

static Collection flatten(boolean[] self)

static Collection flatten(byte[] self)

static Collection flatten(char[] self)

static Collection flatten(short[] self)

static Collection flatten(int[] self)

static Collection flatten(long[] self)

static Collection flatten(float[] self)

Flatten a collection.

static Collection flatten(double[] self)

static Collection flatten(Collection self, Closure flattenUsing)

Overloads the left shift operator to provide an easy way to append objects to a Collection.

static Object get(Map map, Object key, Object defaultValue)

Support the range subscript operator for an Array

static Object getAt(Object self, String property)

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

static List getAt(List self, Range range)

Support the range subscript operator for a List.

static List getAt(List self, EmptyRange range)

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

static List getAt(List self, Collection indices)

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

static List getAt(Object[] self, Collection indices)

Creates a sub-Map containing the given keys.

static List getAt(Object[] array, Range range)

@param array an Array of Objects

static List getAt(Object[] array, IntRange range)

@param array an Array of Objects

static List getAt(Object[] array, EmptyRange range)

static List getAt(Object[] array, ObjectRange range)

static Object getAt(List self, int idx)

static Object getAt(Iterator self, int idx)

static Object getAt(Iterable self, int idx)

A helper method to allow lists to work with subscript operators.

static Object getAt(Map self, Object key)

Support the subscript operator for a Map.

static List getAt(Collection coll, String property)

A convenience method for creating an immutable map.

static List getAt(byte[] array, Range range)

Support the subscript operator with a range for an int array

static List getAt(char[] array, Range range)

static List getAt(short[] array, Range range)

static List getAt(int[] array, Range range)

static List getAt(long[] array, Range range)

static List getAt(float[] array, Range range)

static List getAt(double[] array, Range range)

static List getAt(boolean[] array, Range range)

static List getAt(byte[] array, IntRange range)

static List getAt(char[] array, IntRange range)

static List getAt(short[] array, IntRange range)

static List getAt(int[] array, IntRange range)

static List getAt(long[] array, IntRange range)

static List getAt(float[] array, IntRange range)

static List getAt(double[] array, IntRange range)

static List getAt(boolean[] array, IntRange range)

static List getAt(byte[] array, ObjectRange range)

static List getAt(char[] array, ObjectRange range)

static List getAt(short[] array, ObjectRange range)

static List getAt(int[] array, ObjectRange range)

static List getAt(long[] array, ObjectRange range)

static List getAt(float[] array, ObjectRange range)

static List getAt(double[] array, ObjectRange range)

static List getAt(boolean[] array, ObjectRange range)

static List getAt(byte[] array, Collection indices)

static List getAt(char[] array, Collection indices)

static List getAt(short[] array, Collection indices)

static List getAt(int[] array, Collection indices)

static List getAt(long[] array, Collection indices)

static List getAt(float[] array, Collection indices)

static List getAt(double[] array, Collection indices)

static List getAt(boolean[] array, Collection indices)

static boolean getAt(BitSet self, int index)

static BitSet getAt(BitSet self, IntRange range)

static CharSequence getAt(CharSequence self, Collection indices)

static CharSequence getAt(CharSequence text, EmptyRange range)

static CharSequence getAt(CharSequence text, int index)

static CharSequence getAt(CharSequence text, IntRange range)

static CharSequence getAt(CharSequence text, Range range)

static List getAt(Matcher self, Collection indices)

static Object getAt(Matcher matcher, int idx)

static String getAt(String self, Collection indices)

static String getAt(String text, EmptyRange range)

static String getAt(String text, int index)

static String getAt(String text, IntRange range)

static String getAt(String text, Range range)

static byte[] getBytes(File file)

static byte[] getBytes(URL url)

static byte[] getBytes(InputStream is)

static char[] getChars(CharSequence self)

static char[] getChars(String self)

static int getCount(Matcher matcher)

static MetaClass getMetaClass(Class c)

static MetaClass getMetaClass(Object obj)

static MetaClass getMetaClass(GroovyObject obj)

Sets/updates the metaclass for a given object to a closure.

static List getMetaPropertyValues(Object self)

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

static Map getProperties(Object self)

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

static ClassLoader getRootLoader(ClassLoader self)

Convenience method to dynamically create a new instance of this class.

protected static List getSubList(List self, List splice)

static String getText(File file, String charset)

static String getText(File file)

static String getText(URL url)

static String getText(URL url, Map parameters)

static String getText(URL url, String charset)

static String getText(URL url, Map parameters, String charset)

static String getText(InputStream is)

static String getText(InputStream is, String charset)

static String getText(Reader reader)

static String getText(BufferedReader reader)

static Collection grep(Object self, Object filter)

static Collection grep(Collection self, Object filter)

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

static Collection grep(Object[] self, Object filter)

static Collection grep(Object self)

static Collection grep(Collection self)

static Collection grep(Object[] self)

protected static void groupAnswer(Map answer, Object element, Object value)

static Map groupBy(Collection self, Closure closure)

static Map groupBy(Collection self, Object... closures)

static Map groupBy(Collection self, List closures)

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

static Map groupBy(Map self, Closure closure)

static Map groupBy(Map self, Object... closures)

static Map groupBy(Map self, List closures)

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

static Map groupEntriesBy(Map self, Closure closure)

static boolean hasGroup(Matcher matcher)

static MetaProperty hasProperty(Object self, String name)

static Object head(List self)

Returns the items from the List excluding the first item.

static Object head(Object[] self)

static Object identity(Object self, Closure closure)

static Boolean implies(Boolean left, Boolean right)

static Object inject(Collection self, Closure closure)

static Object inject(Collection self, Object initialValue, Closure closure)

static Object inject(Map self, Object initialValue, Closure closure)

static Object inject(Iterator self, Object initialValue, Closure closure)

static Object inject(Object self, Closure closure)

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

static Object inject(Object self, Object initialValue, Closure closure)

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

static Object inject(Object[] self, Closure closure)

static Object inject(Object[] self, Object initialValue, Closure closure)

Sums the items in a collection.

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, Number right)

Bitwise NEGATE a BitSet.

static Number intdiv(Number left, Character right)

Bitwise OR together two BitSets.

static Number intdiv(Character left, Character right)

Bitwise XOR together two Numbers.

static Number intdiv(Number left, Number right)

static Collection intersect(Collection left, Collection right)

static Map intersect(Map left, Map right)

Returns true if the intersection of two collections is empty.

static Object invokeMethod(Object object, String method, Object arguments)

static boolean is(Object self, Object other)

Identity check.

static boolean isAllWhitespace(CharSequence self)

static boolean isAllWhitespace(String self)

static boolean isBigDecimal(CharSequence self)

static boolean isBigDecimal(String self)

static boolean isBigInteger(CharSequence self)

static boolean isBigInteger(String self)

static boolean isCase(Object caseValue, Object switchValue)

static boolean isCase(Class caseValue, Object switchValue)

static boolean isCase(Collection caseValue, Object switchValue)

static boolean isCase(Map caseValue, Object switchValue)

static boolean isCase(Number caseValue, Number switchValue)

static boolean isCase(CharSequence caseValue, Object switchValue)

static boolean isCase(GString caseValue, Object switchValue)

static boolean isCase(Pattern caseValue, Object switchValue)

static boolean isCase(String caseValue, Object switchValue)

static boolean isDigit(Character self)

static boolean isDouble(CharSequence self)

static boolean isDouble(String self)

static boolean isFloat(CharSequence self)

static boolean isFloat(String self)

static boolean isInteger(CharSequence self)

static boolean isInteger(String self)

static boolean isLetter(Character self)

Transform a Number into a Double

static boolean isLetterOrDigit(Character self)

Transform a Number into a BigDecimal

static boolean isLong(CharSequence self)

static boolean isLong(String self)

static boolean isLowerCase(Character self)

Transform a Number into a Float

static boolean isNumber(CharSequence self)

static boolean isNumber(String self)

static boolean isUpperCase(Character self)

static boolean isWhitespace(Character self)

static Iterator iterator(Object[] a)

static Iterator iterator(Object o)

static Iterator iterator(Enumeration enumeration)

static Iterator iterator(Iterator self)

static Iterator iterator(Matcher matcher)

static Iterator iterator(Reader self)

static Iterator iterator(InputStream self)

static Iterator iterator(DataInputStream self)

static String join(Iterator self, String separator)

Concatenates the toString() representation of each item in this collection, with the given String as a separator between each item.

static String join(Collection self, String separator)

static String join(Object[] self, String separator)

static Object last(List self)

static Object last(Iterable self)

Returns the last item from the array.

static Object last(Object[] self)

Returns the first item from the List.

static Collection leftShift(Collection self, Object value)

Overloads the left shift operator to provide an easy way to append Map.Entry values to a Map.

static BlockingQueue leftShift(BlockingQueue self, Object value)

static Map leftShift(Map self, Map.Entry entry)

static Map leftShift(Map self, Map other)

Implementation of the right shift (unsigned) operator for integral types.

static Number leftShift(Number self, Number operand)

Support the subscript operator with a range for a byte array

static StringBuilder leftShift(CharSequence self, Object value)

static StringBuffer leftShift(String self, Object value)

static StringBuffer leftShift(StringBuffer self, Object value)

static StringBuilder leftShift(StringBuilder self, Object value)

static Writer leftShift(Socket self, Object value)

static OutputStream leftShift(Socket self, byte[] value)

static Writer leftShift(Writer self, Object value)

static Writer leftShift(OutputStream self, Object value)

static void leftShift(ObjectOutputStream self, Object value)

static OutputStream leftShift(OutputStream self, InputStream in)

static OutputStream leftShift(OutputStream self, byte[] value)

static File leftShift(File file, Object text)

static File leftShift(File file, byte[] bytes)

static File leftShift(File file, InputStream data)

static boolean matches(CharSequence self, Pattern pattern)

static boolean matches(String self, Pattern pattern)

static Map.Entry max(Map self, Closure closure)

static Object max(Collection self)

static Object max(Iterator self)

static Object max(Object[] self)

static Object max(Collection self, Closure closure)

static Object max(Iterator self, Closure closure)

Selects the maximum value found from the Object array using the closure to determine the correct ordering.

static Object max(Object[] self, Closure closure)

Selects the maximum value found in the collection using the given comparator.

static Object max(Collection self, Comparator comparator)

static Object max(Iterator self, Comparator comparator)

Provide the standard Groovy size() method for Iterator.

static Object max(Object[] self, Comparator comparator)

static MetaClass metaClass(Class self, Closure closure)

Allows an Enumeration to behave like an Iterator.

static MetaClass metaClass(Object self, Closure closure)

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 Object min(Collection self)

Adds min() method to Iterator objects.

static Object min(Iterator self)

static Object min(Object[] self)

static Object min(Collection self, Comparator comparator)

static Object min(Iterator self, Comparator comparator)

static Object min(Object[] self, Comparator comparator)

static Object min(Collection self, Closure closure)

static Map.Entry min(Map self, Closure closure)

static Object min(Iterator self, Closure closure)

Selects the minimum value found from the Object array using the closure to determine the correct ordering.

static Object min(Object[] self, Closure closure)

Adds max() method to Collection objects.

static Set minus(Set self, Collection removeMe)

Create a Set composed of the elements of the first Set minus the elements from the given Iterable.

static Set minus(Set self, Iterable removeMe)

Create an array composed of the elements of the first array minus the elements of the given Iterable.

static Set minus(Set self, Object removeMe)

Create an array composed of the elements of the first array minus the elements of the given array.

static Object[] minus(Object[] self, Iterable removeMe)

Create a List composed of the elements of the first list minus every occurrence of elements of the given Collection.

static Object[] minus(Object[] self, Object[] removeMe)

static List minus(List self, Collection removeMe)

static List minus(List self, Iterable removeMe)

Create a List composed of the elements of the first list minus every occurrence of elements of the given Iterable.

static List minus(List self, Object removeMe)

static Object[] minus(Object[] self, Object removeMe)

Flatten a collection.

static Map minus(Map self, Map removeMe)

Flatten an array.

static Number minus(Character left, Number right)

static Number minus(Number left, Character right)

Power of a Number to a certain exponent.

static Number minus(Character left, Character right)

static CharSequence minus(CharSequence self, Object target)

static String minus(String self, Object target)

static void mixin(MetaClass self, List categoryClasses)

static void mixin(Class self, List categoryClasses)

static void mixin(Class self, Class categoryClass)

static void mixin(Class self, Class[] categoryClass)

static void mixin(MetaClass self, Class categoryClass)

static void mixin(MetaClass self, Class[] categoryClass)

static Number mod(Number left, Number right)

static List multiply(Collection self, Number factor)

static Number multiply(Character left, Number right)

static Number multiply(Number left, Character right)

static Number multiply(Character left, Character right)

Power of an integer to an integer certain exponent.

static Number multiply(BigDecimal left, Double right)

static Number multiply(BigDecimal left, BigInteger right)

static CharSequence multiply(CharSequence self, Number factor)

static String multiply(String self, Number factor)

static DataInputStream newDataInputStream(File file)

static DataOutputStream newDataOutputStream(File file)

static BufferedInputStream newInputStream(File file)

static BufferedInputStream newInputStream(URL url)

static BufferedInputStream newInputStream(URL url, Map parameters)

static Object newInstance(Class c)

Sets the metaclass for a given class.

static Object newInstance(Class c, Object[] args)

Sets/updates the metaclass for a given class to a closure.

static ObjectInputStream newObjectInputStream(File file)

static ObjectInputStream newObjectInputStream(InputStream inputStream)

static ObjectInputStream newObjectInputStream(InputStream inputStream, ClassLoader classLoader)

static ObjectInputStream newObjectInputStream(File file, ClassLoader classLoader)

static ObjectOutputStream newObjectOutputStream(File file)

static ObjectOutputStream newObjectOutputStream(OutputStream outputStream)

static BufferedOutputStream newOutputStream(File file)

static PrintWriter newPrintWriter(File file)

static PrintWriter newPrintWriter(File file, String charset)

static PrintWriter newPrintWriter(Writer writer)

static BufferedReader newReader(File file)

static BufferedReader newReader(File file, String charset)

static BufferedReader newReader(InputStream self)

static BufferedReader newReader(InputStream self, String charset)

static BufferedReader newReader(URL url)

static BufferedReader newReader(URL url, Map parameters)

static BufferedReader newReader(URL url, String charset)

static BufferedReader newReader(URL url, Map parameters, String charset)

static BufferedWriter newWriter(File file)

static BufferedWriter newWriter(File file, boolean append)

static BufferedWriter newWriter(File file, String charset, boolean append)

static BufferedWriter newWriter(File file, String charset)

static Character next(Character self)

Compare a Number and a Character.

static Number next(Number self)

static CharSequence next(CharSequence self)

static String next(String self)

static CharSequence normalize(CharSequence self)

static String normalize(String self)

static int numberAwareCompareTo(Comparable self, Comparable other)

Provides a method that compares two comparables using Groovy's default number aware comparator.

static Number or(Number left, Number right)

static BitSet or(BitSet left, BitSet right)

static Boolean or(Boolean left, Boolean right)

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

static CharSequence padLeft(CharSequence self, Number numberOfChars)

static CharSequence padLeft(CharSequence self, Number numberOfChars, CharSequence padding)

static String padLeft(String self, Number numberOfChars)

static String padLeft(String self, Number numberOfChars, String padding)

static CharSequence padRight(CharSequence self, Number numberOfChars)

static CharSequence padRight(CharSequence self, Number numberOfChars, CharSequence padding)

static String padRight(String self, Number numberOfChars)

static String padRight(String self, Number numberOfChars, String padding)

static Set permutations(List self)

static Map plus(Map left, Map right)

A helper method to allow maps to work with subscript operators

static Map plus(Map self, Collection entries)

static Object[] plus(Object[] left, Object[] right)

static Object[] plus(Object[] left, Object right)

static Object[] plus(Object[] left, Collection right)

static Object[] plus(Object[] left, Iterable right)

static Collection plus(Collection left, Collection right)

static Collection plus(Collection left, Iterable right)

static List plus(List self, int index, Object[] items)

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 List plus(List self, int index, List additions)

Creates a new List by inserting all of the elements in the given Iterable to the elements from this List at the specified index.

static List plus(List self, int index, Iterable additions)

static Collection plus(Collection left, Object right)

static Number plus(Character left, Number right)

static Number plus(Number left, Character right)

static Number plus(Character left, Character right)

static CharSequence plus(CharSequence left, Object value)

static String plus(Number value, String right)

static String plus(String left, Object value)

static String plus(StringBuffer left, String value)

static Object pop(List self)

static Number power(Number self, Number exponent)

static Number power(BigDecimal self, Integer exponent)

Divide one Character by another.

static Number power(BigInteger self, Integer exponent)

Integer Divide a Character by a Number.

static Number power(Integer self, Integer exponent)

Integer Divide a Number by a Character.

static Number power(Long self, Integer exponent)

Integer Divide two Numbers.

static Character previous(Character self)

static Number previous(Number self)

@todo maybe a double dispatch thing to handle new large numbers?

static CharSequence previous(CharSequence self)

static String previous(String self)

protected static Object primitiveArrayGet(Object self, int idx)

protected static List primitiveArrayGet(Object self, Range range)

protected static List primitiveArrayGet(Object self, Collection indices)

Checks whether the array contains the given value.

protected static Object primitiveArrayPut(Object self, int idx, Object newValue)

Checks whether the array contains the given value.

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 print(PrintWriter self, Object value)

Print a value formatted Groovy style to the print writer.

static void print(PrintStream self, Object value)

static void print(Closure self, Object value)

static void print(Object self, PrintWriter out)

static void printf(Object self, String format, Object[] values)

static void printf(Object self, String format, Object arg)

static void println(Object self)

static void println(Closure self)

Print a linebreak to the standard output stream.

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 void println(PrintWriter self, Object value)

Print a value formatted Groovy style (followed by a newline) to the print writer.

static void println(PrintStream self, Object value)

static void println(Closure self, Object value)

static void println(Object self, PrintWriter out)

static boolean push(List self, Object value)

static Map putAll(Map self, Collection entries)

static void putAt(Object self, String property, Object newValue)

static void putAt(List self, int idx, Object value)

A helper method to allow lists to work with subscript operators.

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)

static void putAt(List self, IntRange range, Collection col)

List subscript assignment operator when given a range as the index.

static void putAt(List self, IntRange range, Object value)

static void putAt(List self, List splice, List values)

static void putAt(List self, List splice, Object value)

static Object putAt(Map self, Object key, Object value)

static void putAt(BitSet self, IntRange range, boolean value)

Support assigning a range of values with a single assignment statement.

static void putAt(BitSet self, int index, boolean value)

Converts this array to a List of the same size, with each element added to the list.

static void putAt(StringBuffer self, EmptyRange range, Object value)

static void putAt(StringBuffer self, IntRange range, Object value)

static byte[] readBytes(File file)

static String readLine(Reader self)

static List readLines(CharSequence self)

static List readLines(String self)

static List readLines(File file)

static List readLines(File file, String charset)

static List readLines(InputStream stream)

static List readLines(InputStream stream, String charset)

static List readLines(URL self)

static List readLines(URL self, String charset)

static List readLines(Reader reader)

static boolean removeAll(Collection self, Object[] items)

static boolean removeAll(Collection self, Closure condition)

static boolean renameTo(File self, String newPathName)

static CharSequence replaceAll(CharSequence self, CharSequence regex, CharSequence replacement)

static CharSequence replaceAll(CharSequence self, CharSequence regex, Closure closure)

static CharSequence replaceAll(CharSequence self, Pattern pattern, CharSequence replacement)

static String replaceAll(CharSequence self, Pattern pattern, Closure closure)

static String replaceAll(String self, Pattern pattern, Closure closure)

static String replaceAll(String self, Pattern pattern, String replacement)

static String replaceAll(String self, String regex, Closure closure)

static String replaceFirst(CharSequence self, CharSequence regex, CharSequence replacement)

static String replaceFirst(CharSequence self, CharSequence regex, Closure closure)

static CharSequence replaceFirst(CharSequence self, Pattern pattern, CharSequence replacement)

static String replaceFirst(CharSequence self, Pattern pattern, Closure closure)

static String replaceFirst(String self, Pattern pattern, Closure closure)

static String replaceFirst(String self, Pattern pattern, String replacement)

static String replaceFirst(String self, String regex, Closure closure)

static List respondsTo(Object self, String name, Object[] argTypes)

static List respondsTo(Object self, String name)

static boolean retainAll(Collection self, Object[] items)

static boolean retainAll(Collection self, Closure condition)

static List reverse(List self)

Reverses the elements in a list.

static List reverse(List self, boolean mutate)

Creates a new array containing items which are the same as this array but in reverse order.

static Object[] reverse(Object[] self)

static Object[] reverse(Object[] self, boolean mutate)

static Iterator reverse(Iterator self)

static CharSequence reverse(CharSequence self)

static String reverse(String self)

static Map reverseEach(Map self, Closure closure)

static List reverseEach(List self, Closure closure)

static Object[] reverseEach(Object[] self, Closure closure)

static Number rightShift(Number self, Number operand)

Support the subscript operator with a range for a char array

static Number rightShiftUnsigned(Number self, Number operand)

Support the subscript operator with a range for a short array

static int round(Float number)

static float round(Float number, int precision)

static long round(Double number)

static double round(Double number, int precision)

Converts the character to uppercase.

static TimerTask runAfter(Timer timer, int delay, Closure closure)

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

static void setBytes(File file, byte[] bytes)

static void setBytes(OutputStream os, byte[] bytes)

static void setIndex(Matcher matcher, int idx)

static void setMetaClass(Class self, MetaClass metaClass)

static void setMetaClass(Object self, MetaClass metaClass)

static void setMetaClass(GroovyObject self, MetaClass metaClass)

static void setText(File file, String text)

static void setText(File file, String text, String charset)

static int size(Iterator self)

static int size(Object[] self)

static int size(boolean[] array)

static int size(byte[] array)

static int size(char[] array)

Converts this array to a List of the same size, with each element added to the list.

static int size(short[] array)

Converts this array to a List of the same size, with each element added to the list.

static int size(int[] array)

static int size(long[] array)

static int size(float[] array)

static int size(double[] array)

static int size(CharSequence text)

static long size(Matcher self)

static int size(String text)

static int size(StringBuffer buffer)

static long size(File self)

static List sort(Collection self)

static List sort(Collection self, boolean mutate)

Sorts the elements from the given map into a new ordered map using the closure as a comparator to determine the ordering.

static Map sort(Map self, Closure closure)

static Map sort(Map self, Comparator comparator)

static Map sort(Map self)

static Object[] sort(Object[] self)

static Object[] sort(Object[] self, boolean mutate)

Sorts the given iterator items into a sorted iterator.

static Iterator sort(Iterator self)

static Iterator sort(Iterator self, Comparator comparator)

static List sort(Collection self, Comparator comparator)

static List sort(Collection self, boolean mutate, Comparator comparator)

Sorts the given array into sorted order using the given comparator.

static Object[] sort(Object[] self, Comparator comparator)

static Object[] sort(Object[] self, boolean mutate, Comparator comparator)

Sorts the given iterator items into a sorted iterator using the Closure to determine the correct ordering.

static Iterator sort(Iterator self, Closure closure)

static Object[] sort(Object[] self, Closure closure)

static Object[] sort(Object[] self, boolean mutate, Closure closure)

static List sort(Collection self, Closure closure)

static List sort(Collection self, boolean mutate, Closure closure)

Avoids doing unnecessary work when sorting an already sorted set (i.e. an identity function for an already sorted set).

static SortedSet sort(SortedSet self)

Removes the last item from the List.

static SortedMap sort(SortedMap self)

static Collection split(Object self, Closure closure)

static Collection split(Collection self, Closure closure)

static CharSequence[] split(CharSequence self)

static String[] split(GString self)

static String[] split(String self)

static Object splitEachLine(CharSequence self, CharSequence regex, Closure closure)

static Object splitEachLine(CharSequence self, Pattern pattern, Closure closure)

static Object splitEachLine(String self, Pattern pattern, Closure closure)

static Object splitEachLine(String self, String regex, Closure closure)

static Object splitEachLine(File self, String regex, Closure closure)

static Object splitEachLine(File self, Pattern pattern, Closure closure)

static Object splitEachLine(File self, String regex, String charset, Closure closure)

static Object splitEachLine(File self, Pattern pattern, String charset, Closure closure)

static Object splitEachLine(URL self, String regex, Closure closure)

static Object splitEachLine(URL self, Pattern pattern, Closure closure)

static Object splitEachLine(URL self, String regex, String charset, Closure closure)

static Object splitEachLine(URL self, Pattern pattern, String charset, Closure closure)

static Object splitEachLine(Reader self, String regex, Closure closure)

static Object splitEachLine(Reader self, Pattern pattern, Closure closure)

static Object splitEachLine(InputStream stream, String regex, String charset, Closure closure)

static Object splitEachLine(InputStream stream, Pattern pattern, String charset, Closure closure)

static Object splitEachLine(InputStream stream, String regex, Closure closure)

static Object splitEachLine(InputStream stream, Pattern pattern, Closure closure)

static SpreadMap spread(Map self)

static String sprintf(Object self, String format, Object[] values)

static String sprintf(Object self, String format, Object arg)

static void step(Number self, Number to, Number stepNumber, Closure closure)

Get the absolute value

static CharSequence stripIndent(CharSequence self)

static CharSequence stripIndent(CharSequence self, int numChars)

static String stripIndent(String self)

static String stripIndent(String self, int numChars)

static CharSequence stripMargin(CharSequence self)

static CharSequence stripMargin(CharSequence self, char marginChar)

static String stripMargin(CharSequence self, CharSequence marginChar)

static String stripMargin(String self)

static String stripMargin(String self, char marginChar)

static String stripMargin(String self, String marginChar)

static Map subMap(Map map, Collection keys)

Creates a sub-Map containing the given keys.

static Map subMap(Map map, Object[] keys)

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 Set subsequences(List self)

Finds all permutations of a collection.

static Object sum(Collection self)

Sums the items in an array.

static Object sum(Object[] self)

static Object sum(Iterator self)

static Object sum(Collection self, Object initialValue)

static Object sum(Object[] self, Object initialValue)

static Object sum(Iterator self, Object initialValue)

static Object sum(Collection self, Closure closure)

Sums the result of apply a closure to each item of an array.

static Object sum(Object[] self, Closure closure)

static Object sum(Iterator self, Closure closure)

static Object sum(Collection self, Object initialValue, Closure closure)

static Object sum(Object[] self, Object initialValue, Closure closure)

static Object sum(Iterator self, Object initialValue, Closure closure)

static List tail(List self)

static Object[] tail(Object[] self)

Returns the first num elements from the head of this list.

static List take(List self, int num)

Returns the first num elements from the head of this array.

static Object[] take(Object[] self, int num)

static List take(Iterable self, int num)

Returns a new map containing the first num elements from the head of this map.

static Map take(Map self, int num)

static Iterator take(Iterator self, int num)

static CharSequence take(CharSequence self, int num)

static List takeWhile(List self, Closure condition)

static List takeWhile(Iterable 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 Map takeWhile(Map self, Closure condition)

Returns the longest prefix of this array where each element passed to the given closure evaluates to true.

static Object[] takeWhile(Object[] self, Closure condition)

static Iterator takeWhile(Iterator self, Closure condition)

static void times(Number self, Closure closure)

static String toArrayString(Object[] self)

static BigDecimal toBigDecimal(Number self)

Logical implication of two boolean operators

static BigDecimal toBigDecimal(CharSequence self)

static BigDecimal toBigDecimal(String self)

static BigInteger toBigInteger(Number self)

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

static BigInteger toBigInteger(CharSequence self)

static BigInteger toBigInteger(String self)

static Boolean toBoolean(Boolean self)

static Boolean toBoolean(String self)

static Character toCharacter(String self)

static Double toDouble(Number self)

Logical disjunction of two boolean operators

static Double toDouble(CharSequence self)

static Double toDouble(String self)

static Float toFloat(Number self)

Logical conjunction of two boolean operators.

static Float toFloat(CharSequence self)

static Float toFloat(String self)

static Integer toInteger(Number self)

static Integer toInteger(CharSequence self)

static Integer toInteger(String self)

static List toList(Collection self)

Convert an iterator to a List.

static List toList(Iterator self)

static List toList(Iterable self)

Convert an enumeration to a List.

static List toList(Enumeration self)

static List toList(Object[] array)

static List toList(byte[] array)

Converts this array to a Set, with each unique element added to the set.

static List toList(boolean[] array)

Converts this array to a Set, with each unique element added to the set.

static List toList(char[] array)

Converts this array to a Set, with each unique element added to the set.

static List toList(short[] array)

Converts this array to a Set, with each unique element added to the set.

static List toList(int[] array)

Converts this array to a Set, with each unique element added to the set.

static List toList(long[] array)

Converts this array to a Set, with each unique element added to the set.

static List toList(float[] array)

Converts this array to a Set, with each unique element added to the set.

static List toList(double[] array)

Converts this array to a Set, with each unique element added to the set.

static List toList(CharSequence self)

static List toList(String self)

static String toListString(Collection self)

static String toListString(Collection self, int maxSize)

static Long toLong(Number self)

static Long toLong(CharSequence self)

static Long toLong(String self)

static char toLowerCase(Character self)

static String toMapString(Map self)

Increment a Character by one.

static String toMapString(Map self, int maxSize)

static Set toSet(byte[] array)

static Set toSet(boolean[] array)

static Set toSet(char[] array)

static Set toSet(short[] array)

static Set toSet(int[] array)

Implements the getAt(int) method for primitive type arrays.

static Set toSet(long[] array)

Implements the getAt(Range) method for primitive type arrays.

static Set toSet(float[] array)

static Set toSet(double[] array)

static Set toSet(Collection self)

Implements the setAt(int idx) method for primitive type arrays.

static Set toSet(Iterator self)

static Set toSet(Enumeration self)

static Set toSet(CharSequence self)

static Set toSet(String self)

static Short toShort(CharSequence self)

static Short toShort(String self)

static SpreadMap toSpreadMap(Map self)

Creates a spreadable map from this array.

static SpreadMap toSpreadMap(Object[] self)

static SpreadMap toSpreadMap(List self)

static String toString(boolean[] self)

static String toString(byte[] self)

static String toString(char[] self)

static String toString(short[] self)

Returns the string representation of the given list.

static String toString(int[] self)

static String toString(long[] self)

static String toString(float[] self)

static String toString(double[] self)

static String toString(AbstractMap self)

static String toString(AbstractCollection self)

static String toString(Object[] self)

static String toString(Object value)

static URI toURI(CharSequence self)

static URI toURI(String self)

static URL toURL(CharSequence self)

static URL toURL(String self)

static char toUpperCase(Character self)

static List tokenize(CharSequence self)

static List tokenize(CharSequence self, Character token)

static List tokenize(CharSequence self, CharSequence token)

static List tokenize(String self)

static List tokenize(String self, Character token)

static List tokenize(String self, String token)

static CharSequence tr(CharSequence self, CharSequence sourceSet, CharSequence replacementSet)

static String tr(String self, String sourceSet, String replacementSet)

static void transformChar(Reader self, Writer writer, Closure closure)

static void transformLine(Reader reader, Writer writer, Closure closure)

static List transpose(List self)

static void traverse(File self, Map options, Closure closure)

static void traverse(File self, Closure closure)

static void traverse(File self, Map options)

static float trunc(Float number, int precision)

static float trunc(Float number)

static double trunc(Double number)

static double trunc(Double number, int precision)

static Number unaryMinus(Number left)

static CharSequence unexpand(CharSequence self)

static CharSequence unexpand(CharSequence self, int tabStop)

static String unexpand(String self)

static String unexpand(String self, int tabStop)

static CharSequence unexpandLine(CharSequence self, int tabStop)

static String unexpandLine(String self, int tabStop)

static Iterator unique(Iterator self)

static Collection unique(Collection self)

static Collection unique(Collection self, boolean mutate)

static Iterator unique(Iterator self, Closure closure)

static Collection unique(Collection self, Closure closure)

static Collection unique(Collection self, boolean mutate, Closure closure)

static Iterator unique(Iterator self, Comparator comparator)

Returns an iterator equivalent to this iterator with all duplicated items removed by using the supplied comparator.

static Collection unique(Collection self, Comparator comparator)

static Collection unique(Collection self, boolean mutate, Comparator comparator)

static void upto(Number self, Number to, Closure closure)

static void upto(long self, Number to, Closure closure)

static void upto(Long self, Number to, Closure closure)

static void upto(float self, Number to, Closure closure)

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(double self, Number to, Closure closure)

static void upto(Double self, Number to, Closure closure)

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

static void upto(BigInteger self, Number to, Closure closure)

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

static void upto(BigDecimal self, Number to, Closure closure)

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

static Object use(Object self, Class categoryClass, Closure closure)

Scoped use method

static Object use(Object self, List categoryClassList, Closure closure)

static Object use(Object self, Object[] array)

static Object with(Object self, Closure closure)

static Object withDataInputStream(File file, Closure closure)

static Object withDataOutputStream(File file, Closure closure)

static Map withDefault(Map self, Closure init)

An alias for withLazyDefault which decorates a list allowing it to grow when called with index values outside the normal list bounds.

static List withDefault(List self, Closure init)

static List withEagerDefault(List self, Closure init)

Sorts the Collection.

static Object withInputStream(File file, Closure closure)

static Object withInputStream(URL url, Closure closure)

static List withLazyDefault(List self, Closure init)

static Object withObjectInputStream(File file, Closure closure)

static Object withObjectInputStream(File file, ClassLoader classLoader, Closure closure)

static Object withObjectInputStream(InputStream inputStream, Closure closure)

static Object withObjectInputStream(InputStream inputStream, ClassLoader classLoader, Closure closure)

static Object withObjectOutputStream(File file, Closure closure)

static Object withObjectOutputStream(OutputStream outputStream, Closure closure)

static Object withObjectStreams(Socket socket, Closure closure)

static Object withOutputStream(File file, Closure closure)

static Object withPrintWriter(File file, Closure closure)

static Object withPrintWriter(File file, String charset, Closure closure)

static Object withPrintWriter(Writer writer, Closure closure)

static Object withReader(File file, Closure closure)

static Object withReader(File file, String charset, Closure closure)

static Object withReader(Reader reader, Closure closure)

static Object withReader(URL url, Closure closure)

static Object withReader(URL url, String charset, Closure closure)

static Object withReader(InputStream in, Closure closure)

static Object withReader(InputStream in, String charset, Closure closure)

static Object withStream(InputStream stream, Closure closure)

static Object withStream(OutputStream os, Closure closure)

static Object withStreams(Socket socket, Closure closure)

static Object withWriter(File file, Closure closure)

static Object withWriter(File file, String charset, Closure closure)

static Object withWriter(Writer writer, Closure closure)

static Object withWriter(OutputStream stream, Closure closure)

static Object withWriter(OutputStream stream, String charset, Closure closure)

static Object withWriterAppend(File file, String charset, Closure closure)

static Object withWriterAppend(File file, Closure closure)

static void write(Writer self, Writable writable)

static void write(File file, String text)

static void write(File file, String text, String charset)

static void writeLine(BufferedWriter writer, String line)

static BitSet xor(BitSet left, BitSet right)

static Number xor(Number left, Number right)

static Boolean xor(Boolean left, Boolean right)

 
Methods inherited from class DefaultGroovyMethodsSupport
cloneSimilarCollection, cloneSimilarMap, closeQuietly, closeWithWarning, createSimilarArray, createSimilarCollection, createSimilarCollection, createSimilarList, createSimilarMap, createSimilarOrDefaultCollection, createSimilarSet, normaliseIndex, sameType, subListBorders, subListBorders
 
Methods inherited from class Object
wait, wait, wait, equals, toString, hashCode, getClass, notify, notifyAll
 

Field Detail

DGM_LIKE_CLASSES

public static final Class[] DGM_LIKE_CLASSES


additionals

public static final Class[] additionals


 
Method Detail

abs

public static int abs(Number number)
Truncate the value
Parameters:
number - a Float
precision - the number of decimal places to keep
Returns:
the Float truncated to the number of decimal places specified by precision
Since:
1.6.0


abs

public static long abs(Long number)
Truncate the value
Parameters:
number - a Double
precision - the number of decimal places to keep
Returns:
the Double truncated to the number of decimal places specified by precision
Since:
1.6.4


abs

public static float abs(Float number)
Determine if a Character is uppercase. Synonym for 'Character.isUpperCase(this)'.
Parameters:
self - a Character
Returns:
true if the character is uppercase
See Also:
Character.isUpperCase
Since:
1.5.7


abs

public static double abs(Double number)


accept

@Deprecated
public static Socket accept(ServerSocket serverSocket, Closure closure)


accept

@Deprecated
public static Socket accept(ServerSocket serverSocket, boolean runInANewThread, Closure closure)


addAll

public static boolean addAll(Collection self, Object[] items)


addAll

public static boolean addAll(List self, int index, Object[] items)
Splits all items into two lists based on the closure condition. The first list contains all items matching the closure expression. The second list all those that don't.
Parameters:
self - an Object with an Iterator returning its values
closure - a closure condition
Returns:
a List whose first item is the accepted values and whose second item is the rejected values
Since:
1.6.0


addShutdownHook

public static void addShutdownHook(Object self, Closure closure)


and

public static Number and(Number left, Number right)


and

public static BitSet and(BitSet left, BitSet right)


and

public static Boolean and(Boolean left, Boolean right)
Iterates over the elements of an iterable collection of items, starting from a specified startIndex, and returns the index of the first item that matches the condition specified in the closure.
Parameters:
self - the iteration object over which to iterate
startIndex - start matching from this index
closure - the filter to perform a match on the collection
Returns:
an integer that is the index of the first matched object or -1 if no match was found
Since:
1.5.0


any

public static boolean any(Object self, Closure closure)


any

public static boolean any(Map self, Closure closure)


any

public static boolean any(Object self)


append

@Deprecated}
public static void append(File file, Object text)


append

@Deprecated}
public static void append(File file, byte[] bytes)


append

@Deprecated}
public static void append(File self, InputStream stream)


append

@Deprecated}
public static void append(File file, Object text, String charset)


asBoolean

public static boolean asBoolean(Object object)
Coerce a collection instance to a boolean value. A collection is coerced to false if it's empty, and to true otherwise.
assert [1,2].asBoolean() == true
assert [].asBoolean() == false
Parameters:
collection - the collection
Returns:
the boolean value
Since:
1.7.0


asBoolean

public static boolean asBoolean(Boolean bool)


asBoolean

public static boolean asBoolean(Collection collection)
Coerce an iterator instance to a boolean value. An iterator is coerced to false if there are no more elements to iterate over, and to true otherwise.
Parameters:
iterator - the iterator
Returns:
the boolean value
Since:
1.7.0


asBoolean

public static boolean asBoolean(Map map)
Coerce an enumeration instance to a boolean value. An enumeration is coerced to false if there are no more elements to enumerate, and to true otherwise.
Parameters:
enumeration - the enumeration
Returns:
the boolean value
Since:
1.7.0


asBoolean

public static boolean asBoolean(Iterator iterator)
Coerce an Object array to a boolean value. An Object array is false if the array is of length 0. and to true otherwise
Parameters:
array - the array
Returns:
the boolean value
Since:
1.7.0


asBoolean

public static boolean asBoolean(Enumeration enumeration)
Coerces a byte array to a boolean value. A byte array is false if the array is of length 0, and true otherwise.
Parameters:
array - an array
Returns:
the array's boolean value
Since:
1.7.4


asBoolean

public static boolean asBoolean(Object[] array)
Coerces a short array to a boolean value. A short array is false if the array is of length 0, and true otherwise.
Parameters:
array - an array
Returns:
the array's boolean value
Since:
1.7.4


asBoolean

public static boolean asBoolean(byte[] array)
Coerces an int array to a boolean value. An int array is false if the array is of length 0, and true otherwise.
Parameters:
array - an array
Returns:
the array's boolean value
Since:
1.7.4


asBoolean

public static boolean asBoolean(short[] array)
Coerces a long array to a boolean value. A long array is false if the array is of length 0, and true otherwise.
Parameters:
array - an array
Returns:
the array's boolean value
Since:
1.7.4


asBoolean

public static boolean asBoolean(int[] array)
Coerces a float array to a boolean value. A float array is false if the array is of length 0, and true otherwise.
Parameters:
array - an array
Returns:
the array's boolean value
Since:
1.7.4


asBoolean

public static boolean asBoolean(long[] array)
Coerces a double array to a boolean value. A double array is false if the array is of length 0, and true otherwise.
Parameters:
array - an array
Returns:
the array's boolean value
Since:
1.7.4


asBoolean

public static boolean asBoolean(float[] array)
Coerces a boolean array to a boolean value. A boolean array is false if the array is of length 0, and true otherwise.
Parameters:
array - an array
Returns:
the array's boolean value
Since:
1.7.4


asBoolean

public static boolean asBoolean(double[] array)
Coerces a char array to a boolean value. A char array is false if the array is of length 0, and true otherwise.
Parameters:
array - an array
Returns:
the array's boolean value
Since:
1.7.4


asBoolean

public static boolean asBoolean(boolean[] array)
Coerce a character to a boolean value. A character is coerced to false if it's character value is equal to 0, and to true otherwise.
Parameters:
character - the character
Returns:
the boolean value
Since:
1.7.0


asBoolean

public static boolean asBoolean(char[] array)
Coerce a number to a boolean value. A number is coerced to false if its double value is equal to 0, and to true otherwise, and to true otherwise.
Parameters:
number - the number
Returns:
the boolean value
Since:
1.7.0


asBoolean

public static boolean asBoolean(Character character)


asBoolean

public static boolean asBoolean(Number number)


asBoolean

@Deprecated
public static boolean asBoolean(CharSequence string)


asBoolean

@Deprecated
public static boolean asBoolean(Matcher matcher)


asImmutable

public static Map asImmutable(Map self)
A convenience method for creating an immutable sorted map.
Parameters:
self - a SortedMap
Returns:
an immutable SortedMap
See Also:
Collections.unmodifiableSortedMap
Since:
1.0


asImmutable

public static SortedMap asImmutable(SortedMap self)


asImmutable

public static List asImmutable(List self)


asImmutable

public static Set asImmutable(Set self)


asImmutable

public static SortedSet asImmutable(SortedSet self)


asImmutable

public static Collection asImmutable(Collection self)
A convenience method for creating a synchronized SortedMap.
Parameters:
self - a SortedMap
Returns:
a synchronized SortedMap
See Also:
Collections.synchronizedSortedMap
Since:
1.0


asList

public static List asList(Collection self)
Coerce an object instance to a boolean value. An object is coerced to true if it's not null, to false if it is null.
Parameters:
object - the object to coerce
Returns:
the boolean value
Since:
1.7.0


asSynchronized

public static Map asSynchronized(Map self)


asSynchronized

public static SortedMap asSynchronized(SortedMap self)


asSynchronized

public static Collection asSynchronized(Collection self)


asSynchronized

public static List asSynchronized(List self)


asSynchronized

public static Set asSynchronized(Set self)


asSynchronized

public static SortedSet asSynchronized(SortedSet self)


asType

@SuppressWarnings} catch (GroovyCastException e) {
public static Object asType(Collection col, Class clazz)


asType

@SuppressWarnings}
public static Object asType(Object[] ary, Class clazz)
Converts the given array to either a List, Set, or SortedSet. If the given class is something else, the call is deferred to {link #asType(Object,Class)}.
Parameters:
ary - an array
clazz - the desired class
Returns:
the object resulting from this type conversion
See Also:
asType(java.lang.Object, java.lang.Class)
Since:
1.5.1


asType

@SuppressWarningsif (!(clazz.isInstance(map)) && clazz.isInterface()) {
public static Object asType(Closure cl, Class clazz)
Coerces this map to the given type, using the map's keys as the public method names, and values as the implementation. Typically the value would be a closure which behaves like the method implementation.
Parameters:
map - this map
clazz - the target type
Returns:
a Proxy of the given type, which defers calls to this map's elements.
Since:
1.0


asType

@SuppressWarnings* @since 1.0
public static Object asType(Map map, Class clazz)


asType

@SuppressWarnings* Traverse through each byte of this byte array. Alias for each.
public static Object asType(Number self, Class c)
Traverse through each byte of this Byte array. Alias for each.
Parameters:
self - a Byte array
closure - a closure
See Also:
each(java.lang.Object, groovy.lang.Closure)
Since:
1.5.5


asType

@SuppressWarningsif (mc instanceof ExpandoMetaClass
public static Object asType(Object obj, Class type)
Adds a "metaClass" property to all class objects so you can use the syntax String.metaClass.myMethod = { println "foo" }
Parameters:
c - The java.lang.Class instance
Returns:
An MetaClass instance
Since:
1.5.0


asType

@Deprecated
public static Object asType(CharSequence self, Class c)


asType

@Deprecated
@SuppressWarningspublic static String eachMatch(String self, String regex, Closure closure) {
public static Object asType(GString self, Class c)


asType

@Deprecatedpublic static CharSequence expand(CharSequence self) {
@SuppressWarningsreturn StringGroovyMethods.expand(self);
public static Object asType(String self, Class c)


asType

@Deprecated
public static Object asType(File f, Class c)


asWritable

@Deprecated
public static File asWritable(File file)


asWritable

@Deprecated
public static File asWritable(File file, String encoding)


bitwiseNegate

public static BitSet bitwiseNegate(BitSet self)
Iterates from this number up to the given number, inclusive, incrementing by one each time.
Parameters:
self - a long
to - the end number
closure - the code to execute for each number
Since:
1.0


bitwiseNegate

@Deprecatedreturn StringGroovyMethods.expand(self, tabStop);
public static Pattern bitwiseNegate(CharSequence self)


bitwiseNegate

@Deprecatedreturn StringGroovyMethods.expand(self);
public static Pattern bitwiseNegate(String self)


callClosureForLine

protected static Object callClosureForLine(Closure closure, String line, int counter)


callClosureForMapEntry

protected static Object callClosureForMapEntry(Closure closure, Map.Entry entry)


callClosureForMapEntryAndCounter

protected static Object callClosureForMapEntryAndCounter(Closure closure, Map.Entry entry, int counter)


capitalize

@Deprecatedreturn StringGroovyMethods.expand(self, tabStop);
public static CharSequence capitalize(CharSequence self)


capitalize

@Deprecatedreturn StringGroovyMethods.expandLine(self, tabStop);
public static String capitalize(String self)


center

@Deprecatedreturn StringGroovyMethods.expandLine(self, tabStop);
public static CharSequence center(CharSequence self, Number numberOfChars)


center

@Deprecatedreturn StringGroovyMethods.find(self, regex);
public static CharSequence center(CharSequence self, Number numberOfChars, CharSequence padding)


center

@Deprecatedreturn StringGroovyMethods.find(self, regex, closure);
public static String center(String self, Number numberOfChars)


center

@Deprecatedreturn StringGroovyMethods.find(self, pattern);
public static String center(String self, Number numberOfChars, String padding)


collate

public static List collate(List self, int size)


collate

public static List collate(List self, int size, int step)


collate

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


collate

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


collect

public static List collect(Object self, Closure transform)
Iterates through this aggregate Object transforming each item into a new value using the transform closure, returning a list of transformed values. Example:
def list = [1, 'a', 1.23, true ]
 def types = list.collect { it.class }
 assert types == [Integer, String, BigDecimal, Boolean]
Parameters:
self - an aggregate Object with an Iterator returning its items
transform - the closure used to transform each item of the aggregate object
Returns:
a List of the transformed values
Since:
1.0


collect

public static Collection collect(Object self)
Iterates through this aggregate Object transforming each item into a new value using the transform closure and adding it to the supplied collector.
Parameters:
self - an aggregate Object with an Iterator returning its items
collector - the Collection to which the transformed values are added
transform - the closure used to transform each item of the aggregate object
Returns:
the collector with all transformed values added to it
Since:
1.0


collect

public static Collection collect(Object self, Collection collector, Closure transform)


collect

public static List collect(Collection self, Closure transform)
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.
assert [1,2,3] == [1,2,3].collect()
Parameters:
self - a collection
Returns:
a List of the transformed values
See Also:
Closure.IDENTITY
Since:
1.8.5


collect

public static List collect(Collection self)
Iterates through this collection transforming each value into a new value using the transform closure and adding it to the supplied collector.
assert [1,2,3] as HashSet == [2,4,5,6].collect(new HashSet()) { (int)(it / 2) }
Parameters:
self - a collection
collector - the Collection to which the transformed values are added
transform - the closure used to transform each item of the collection
Returns:
the collector with all transformed values added to it
Since:
1.0


collect

public static Collection collect(Collection self, Collection collector, Closure transform)


collect

public static Collection collect(Map self, Collection collector, Closure transform)


collect

public static List collect(Map self, Closure transform)


collectAll

public static List collectAll(Collection self, Closure transform)


collectAll

public static Collection collectAll(Collection self, Collection collector, Closure transform)


collectEntries

public static Map collectEntries(Map self, Map collector, Closure transform)


collectEntries

public static Map collectEntries(Map self, Closure transform)


collectEntries

public static Map collectEntries(Collection self, Closure transform)
A variant of collectEntries for Iterators.
Parameters:
self - an Iterator
transform - the closure used for transforming, which has an item from self as the parameter and should return a Map.Entry, a Map or a two-element list containing the resulting key and value
Returns:
a Map of the transformed entries
See Also:
collectEntries(Collection, Closure)
Since:
1.8.7


collectEntries

public static Map collectEntries(Iterator self, Closure transform)
A variant of collectEntries for Iterables.
Parameters:
self - an Iterable
transform - the closure used for transforming, which has an item from self as the parameter and should return a Map.Entry, a Map or a two-element list containing the resulting key and value
Returns:
a Map of the transformed entries
See Also:
collectEntries(Iterator, Closure)
Since:
1.8.7


collectEntries

public static Map collectEntries(Iterable self, Closure transform)


collectEntries

public static Map collectEntries(Collection self)
A variant of collectEntries for Iterators using the identity closure as the transform.
Parameters:
self - an Iterator
Returns:
a Map of the transformed entries
See Also:
collectEntries(Collection)
Since:
1.8.7


collectEntries

public static Map collectEntries(Iterator self)
A variant of collectEntries for Iterables using the identity closure as the transform.
Parameters:
self - an Iterable
Returns:
a Map of the transformed entries
See Also:
collectEntries(Iterator)
Since:
1.8.7


collectEntries

public static Map collectEntries(Iterable self)


collectEntries

public static Map collectEntries(Collection self, Map collector, Closure transform)


collectEntries

public static Map collectEntries(Iterator self, Map collector, Closure transform)


collectEntries

public static Map collectEntries(Iterable self, Map collector, Closure transform)
A variant of collectEntries for Collections using the identity closure as the transform and a supplied map as the destination of transformed entries.
Parameters:
self - a Collection
collector - the Map into which the transformed entries are put
Returns:
the collector with all transformed values added to it
See Also:
collectEntries(Collection, Map, Closure)
Since:
1.8.5


collectEntries

public static Map collectEntries(Collection self, Map collector)
A variant of collectEntries for Iterators using the identity closure as the transform and a supplied map as the destination of transformed entries.
Parameters:
self - an Iterator
collector - the Map into which the transformed entries are put
Returns:
the collector with all transformed values added to it
See Also:
collectEntries(Collection, Map)
Since:
1.8.7


collectEntries

public static Map collectEntries(Iterator self, Map collector)
A variant of collectEntries for Iterables using the identity closure as the transform and a supplied map as the destination of transformed entries.
Parameters:
self - an Iterable
collector - the Map into which the transformed entries are put
Returns:
the collector with all transformed values added to it
See Also:
collectEntries(Iterator, Map)
Since:
1.8.7


collectEntries

public static Map collectEntries(Iterable self, Map collector)


collectEntries

public static Map collectEntries(Object[] self, Map collector, Closure transform)
A variant of collectEntries using the identity closure as the transform.
Parameters:
self - an Object array
collector - the Map into which the transformed entries are put
Returns:
the collector with all transformed values added to it
See Also:
collectEntries(Object[], Map, Closure)
Since:
1.8.5


collectEntries

public static Map collectEntries(Object[] self, Map collector)


collectEntries

public static Map collectEntries(Object[] self, Closure transform)
A variant of collectEntries using the identity closure as the transform.
Parameters:
self - an Object array
Returns:
the collector with all transformed values added to it
See Also:
collectEntries(Object[], Closure)
Since:
1.8.5


collectEntries

public static Map collectEntries(Object[] self)


collectMany

public static List collectMany(Collection self, Closure projection)
Projects each item from a source collection to a collection and concatenates (flattens) the resulting collections into a single list.

 def nums = 1..10
 def squaresAndCubesOfEvens = nums.collectMany{ it % 2 ? [] : [it**2, it**3] }
 assert squaresAndCubesOfEvens == [4, 8, 16, 64, 36, 216, 64, 512, 100, 1000]

 def animals = ['CAT', 'DOG', 'ELEPHANT'] as Set
 def smallAnimals = animals.collectMany{ it.size() > 3 ? [] : [it.toLowerCase()] }
 assert smallAnimals == ['cat', 'dog']

 def orig = nums as Set
 def origPlusIncrements = orig.collectMany{ [it, it+1] }
 assert origPlusIncrements.size() == orig.size() * 2
 assert origPlusIncrements.unique().size() == orig.size() + 1
 
Parameters:
self - a collection
projection - a projecting Closure returning a collection of items
Returns:
a list created from the projected collections concatenated (flattened) together
See Also:
sum(java.util.Collection, groovy.lang.Closure)
Since:
1.8.1


collectMany

public static Collection collectMany(Collection self, Collection collector, Closure projection)


collectMany

public static Collection collectMany(Map self, Collection collector, Closure projection)


collectMany

public static Collection collectMany(Map self, Closure projection)


collectMany

public static List collectMany(Object[] self, Closure projection)


collectMany

public static List collectMany(Iterator self, Closure projection)


collectNested

public static List collectNested(Collection self, Closure transform)
Deprecated alias for collectNested
deprecated:
Use collectNested instead
See Also:
collectNested(Collection, Collection, Closure)


collectNested

public static Collection collectNested(Collection self, Collection collector, Closure transform)


combinations

public static List combinations(Collection self)
Finds all non-null subsequences of a list.

Example usage:

def result = [1, 2, 3].subsequences()
 assert result == [[1, 2, 3], [1, 3], [2, 3], [1, 2], [1], [2], [3]] as Set
Parameters:
self - the List of items
Returns:
the subsequences from the list
Since:
1.7.0


compareTo

public static int compareTo(Character left, Number right)


compareTo

public static int compareTo(Number left, Character right)


compareTo

public static int compareTo(Character left, Character right)


compareTo

public static int compareTo(Number left, Number right)


contains

public static boolean contains(int[] self, Object value)
Checks whether the array contains the given value.
Parameters:
self - the array we are searching
value - the value being searched for
Returns:
true if the array contains the value
Since:
1.8.6


contains

public static boolean contains(long[] self, Object value)
Checks whether the array contains the given value.
Parameters:
self - the array we are searching
value - the value being searched for
Returns:
true if the array contains the value
Since:
1.8.6


contains

public static boolean contains(short[] self, Object value)
Returns the string representation of the given array.
Parameters:
self - an array
Returns:
the string representation
Since:
1.6.0


contains

public static boolean contains(char[] self, Object value)
Returns the string representation of the given array.
Parameters:
self - an array
Returns:
the string representation
Since:
1.6.0


contains

public static boolean contains(boolean[] self, Object value)
Returns the string representation of the given array.
Parameters:
self - an array
Returns:
the string representation
Since:
1.6.0


contains

public static boolean contains(double[] self, Object value)
Returns the string representation of the given array.
Parameters:
self - an array
Returns:
the string representation
Since:
1.6.0


contains

public static boolean contains(float[] self, Object value)


contains

public static boolean contains(byte[] self, Object value)
Returns the string representation of the given array.
Parameters:
self - an array
Returns:
the string representation
Since:
1.6.0


contains

public static boolean contains(Object[] self, Object value)
Returns the string representation of the given map.
Parameters:
self - a Map
Returns:
the string representation
See Also:
toMapString(java.util.Map)
Since:
1.0


contains

@Deprecatedreturn StringGroovyMethods.find(self, pattern, closure);
public static boolean contains(CharSequence self, CharSequence text)


contains

@Deprecatedreturn StringGroovyMethods.find(self, pattern);
public static boolean contains(String self, String text)


containsAll

public static boolean containsAll(Collection self, Object[] items)
Modifies this collection by removing its elements that are contained within the specified object array. See also findAll and grep when wanting to produce a new list containing items which don't match some criteria while leaving the original collection unchanged.
Parameters:
self - a Collection to be modified
items - array containing elements to be removed from this collection
Returns:
true if this collection changed as a result of the call
See Also:
Collection.removeAll
Since:
1.7.2


count

public static Number count(Iterator self, Object value)


count

public static Number count(Iterator self, Closure closure)
Counts the number of occurrences which satisfy the given closure from the items within this Iterator. The iterator will become exhausted of elements after determining the count value.

Example usage:

assert [2,4,2,1,3,5,2,4,3].toSet().iterator().count{ it % 2 == 0 } == 2
Parameters:
self - the Iterator from which we count the number of matching occurrences
closure - a closure condition
Returns:
the number of occurrences
Since:
1.8.0


count

public static Number count(Collection self, Object value)
Counts the number of occurrences of the given value inside this collection. Comparison is done using Groovy's == operator (using compareTo(value) == 0 or equals(value) ).

Example usage:

assert [2,4,2,1,3,5,2,4,3].count(4) == 2
Parameters:
self - the collection within which we count the number of occurrences
value - the value being searched for
Returns:
the number of occurrences
Since:
1.0


count

public static Number count(Collection self, Closure closure)


count

public static Number count(Map self, Closure closure)


count

public static Number count(Object[] self, Object value)
Counts the number of occurrences of the given value inside this array. Comparison is done using Groovy's == operator (using compareTo(value) == 0 or equals(value) ).
Parameters:
self - the array within which we count the number of occurrences
value - the value being searched for
Returns:
the number of occurrences
Since:
1.6.4


count

public static Number count(Object[] self, Closure closure)
Counts the number of occurrences of the given value inside this array. Comparison is done using Groovy's == operator (using compareTo(value) == 0 or equals(value) ).
Parameters:
self - the array within which we count the number of occurrences
value - the value being searched for
Returns:
the number of occurrences
Since:
1.6.4


count

public static Number count(int[] self, Object value)
Counts the number of occurrences of the given value inside this array. Comparison is done using Groovy's == operator (using compareTo(value) == 0 or equals(value) ).
Parameters:
self - the array within which we count the number of occurrences
value - the value being searched for
Returns:
the number of occurrences
Since:
1.6.4


count

public static Number count(long[] self, Object value)
Counts the number of occurrences of the given value inside this array. Comparison is done using Groovy's == operator (using compareTo(value) == 0 or equals(value) ).
Parameters:
self - the array within which we count the number of occurrences
value - the value being searched for
Returns:
the number of occurrences
Since:
1.6.4


count

public static Number count(short[] self, Object value)
Counts the number of occurrences of the given value inside this array. Comparison is done using Groovy's == operator (using compareTo(value) == 0 or equals(value) ).
Parameters:
self - the array within which we count the number of occurrences
value - the value being searched for
Returns:
the number of occurrences
Since:
1.6.4


count

public static Number count(char[] self, Object value)
Counts the number of occurrences of the given value inside this array. Comparison is done using Groovy's == operator (using compareTo(value) == 0 or equals(value) ).
Parameters:
self - the array within which we count the number of occurrences
value - the value being searched for
Returns:
the number of occurrences
Since:
1.6.4


count

public static Number count(boolean[] self, Object value)
Counts the number of occurrences of the given value inside this array. Comparison is done using Groovy's == operator (using compareTo(value) == 0 or equals(value) ).
Parameters:
self - the array within which we count the number of occurrences
value - the value being searched for
Returns:
the number of occurrences
Since:
1.6.4


count

public static Number count(double[] self, Object value)
Counts the number of occurrences of the given value inside this array. Comparison is done using Groovy's == operator (using compareTo(value) == 0 or equals(value) ).
Parameters:
self - the array within which we count the number of occurrences
value - the value being searched for
Returns:
the number of occurrences
Since:
1.6.4


count

public static Number count(float[] self, Object value)
Counts the number of occurrences of the given value inside this array. Comparison is done using Groovy's == operator (using compareTo(value) == 0 or equals(value) ).
Parameters:
self - the array within which we count the number of occurrences
value - the value being searched for
Returns:
the number of occurrences
Since:
1.6.4


count

public static Number count(byte[] self, Object value)


count

@Deprecatedreturn StringGroovyMethods.find(self, pattern, closure);
public static int count(CharSequence self, CharSequence text)


count

@Deprecatedreturn StringGroovyMethods.find(self, regex);
public static int count(String self, String text)


countBy

public static Map countBy(Collection self, Closure closure)
Sorts all array members into groups determined by the supplied mapping closure and counts the group size. The closure should return the key that each item should be grouped by. The returned Map will have an entry for each distinct key returned from the closure, with each value being the frequency of items occurring for that group.

Example usage:

assert ([1,2,2,2,3] as Object[]).countBy{ it % 2 } == [1:2, 0:3]
Parameters:
self - an object array to group and count
closure - a closure mapping items to the frequency keys
Returns:
a new Map grouped by keys with frequency counts
See Also:
countBy(Collection, Closure)
Since:
1.8.0


countBy

public static Map countBy(Object[] self, Closure closure)
Sorts all iterator items into groups determined by the supplied mapping closure and counts the group size. The closure should return the key that each item should be grouped by. The returned Map will have an entry for each distinct key returned from the closure, with each value being the frequency of items occurring for that group.

Example usage:

assert [1,2,2,2,3].toSet().iterator().countBy{ it % 2 } == [1:2, 0:1]
Parameters:
self - an iterator to group and count
closure - a closure mapping items to the frequency keys
Returns:
a new Map grouped by keys with frequency counts
See Also:
countBy(Collection, Closure)
Since:
1.8.0


countBy

public static Map countBy(Iterator self, Closure closure)


countBy

public static Map countBy(Map self, Closure closure)
Groups the current element according to the value
Parameters:
answer - the map containing the results
element - the element to be placed
value - the value according to which the element will be placed
Since:
1.5.0


createStringBufferWriter

@Deprecatedreturn StringGroovyMethods.find(self, regex, closure);
protected static StringBufferWriter createStringBufferWriter(StringBuffer self)


createStringWriter

@Deprecatedreturn StringGroovyMethods.findAll(self, regex);
protected static StringWriter createStringWriter(String self)


deleteDir

@Deprecated
public static boolean deleteDir(File self)


denormalize

@Deprecated
public static CharSequence denormalize(CharSequence self)


denormalize

@Deprecated
public static String denormalize(String self)


disjoint

public static boolean disjoint(Collection left, Collection right)
Compare the contents of this array to the contents of the given array.
Parameters:
left - an int array
right - the array being compared
Returns:
true if the contents of both arrays are equal.
Since:
1.5.0


div

public static Number div(Character left, Number right)
Bitwise AND together two Numbers.
Parameters:
left - a Number
right - another Number to bitwise AND
Returns:
the bitwise AND of both Numbers
Since:
1.0


div

public static Number div(Number left, Character right)
Bitwise AND together two BitSets.
Parameters:
left - a BitSet
right - another BitSet to bitwise AND
Returns:
the bitwise AND of both BitSets
Since:
1.5.0


div

public static Number div(Character left, Character right)
Bitwise XOR together two BitSets. Called when the '^' operator is used between two bit sets.
Parameters:
left - a BitSet
right - another BitSet to bitwise AND
Returns:
the bitwise XOR of both BitSets
Since:
1.5.0


downto

public static void downto(Number self, Number to, Closure closure)
Iterates from this number down to the given number, inclusive, decrementing by one each time.
Parameters:
self - a double
to - the end number
closure - the code to execute for each number
Since:
1.0


downto

public static void downto(long self, Number to, Closure closure)


downto

public static void downto(Long self, Number to, Closure closure)


downto

public static void downto(float self, Number to, Closure closure)


downto

public static void downto(Float self, Number to, Closure closure)


downto

public static void downto(double self, Number to, Closure closure)


downto

public static void downto(Double self, Number to, Closure closure)
Iterates from this number up to the given number using a step increment. Each intermediate number is passed to the given closure. Example:
0.step( 10, 2 ) {
   println it
 }
Prints even numbers 0 through 8.
Parameters:
self - a Number to start with
to - a Number to go up to, exclusive
stepNumber - a Number representing the step increment
closure - the closure to call
Since:
1.0


downto

public static void downto(BigInteger self, Number to, Closure closure)


downto

public static void downto(BigDecimal self, Number to, Closure closure)
Get the absolute value
Parameters:
number - a Number
Returns:
the absolute value of that Number
Since:
1.0


drop

public static List drop(List self, int num)


drop

public static List drop(Iterable self, int num)
Drops the given number of elements from the head of this array if they are available.
 String[] strings = [ 'a', 'b', 'c' ]
 assert strings.drop( 0 ) == [ 'a', 'b', 'c' ] as String[]
 assert strings.drop( 2 ) == [ 'c' ] as String[]
 assert strings.drop( 5 ) == [] as String[]
 
Parameters:
self - the original array
num - the number of elements to drop from this array
Returns:
an array consisting of all elements of this array except the first num ones, or else the empty array, if this array has less than num elements.
Since:
1.8.1


drop

public static Object[] drop(Object[] self, int num)


drop

public static Map drop(Map self, int num)


drop

public static Iterator drop(Iterator self, int num)
Returns the longest prefix of this list where each element passed to the given closure condition evaluates to true. Similar to takeWhile(Iterable, groovy.lang.Closure) except that it attempts to preserve the type of the original list.
 def nums = [ 1, 3, 2 ]
 assert nums.takeWhile{ it < 1 } == []
 assert nums.takeWhile{ it < 3 } == [ 1 ]
 assert nums.takeWhile{ it < 4 } == [ 1, 3, 2 ]
 
Parameters:
self - the original list
condition - the closure that must evaluate to true to continue taking elements
Returns:
a prefix of the given list where each element passed to the given closure evaluates to true
Since:
1.8.7


drop

@Deprecated
public static CharSequence drop(CharSequence self, int num)


dropWhile

public static List dropWhile(List self, Closure condition)


dropWhile

public static List dropWhile(Iterable 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).
 def shopping = [milk:1, bread:2, chocolate:3]
 assert shopping.dropWhile{ it.key.size() < 6 } == [chocolate:3]
 assert shopping.dropWhile{ it.value % 2 } == [bread:2, chocolate:3]
 assert shopping.dropWhile{ k, v -> k.size() + v <= 7 } == [chocolate:3]
 
If the map instance does not have ordered keys, then this function could appear to drop random entries. Groovy by default uses LinkedHashMap, so this shouldn't be an issue in the main.
Parameters:
self - a Map
condition - a 1 (or 2) arg Closure that must evaluate to true for the entry (or key and value) to continue dropping elements
Returns:
the shortest suffix of the given Map such that the given closure condition evaluates to true for each element dropped from the front of the Map
Since:
1.8.7


dropWhile

public static Map dropWhile(Map self, Closure condition)


dropWhile

public static Object[] dropWhile(Object[] self, Closure condition)


dropWhile

public static Iterator dropWhile(Iterator self, Closure condition)


dump

public static String dump(Object self)


each

public static Object each(Object self, Closure closure)
Iterates through an aggregate type or data structure, passing each item to the given closure. Custom types may utilize this method by simply providing an "iterator()" method. The items returned from the resulting iterator will be passed to the closure.
Parameters:
self - the object over which we iterate
closure - the closure applied on each element found
Returns:
the self Object
Since:
1.0


each

public static Map each(Map self, Closure closure)


eachByte

public static void eachByte(Byte[] self, Closure closure)


eachByte

public static void eachByte(byte[] self, Closure closure)


eachByte

@Deprecated
public static void eachByte(File self, Closure closure)


eachByte

@Deprecated
public static void eachByte(File self, int bufferLen, Closure closure)


eachByte

@Deprecated
public static void eachByte(InputStream is, Closure closure)


eachByte

@Deprecated
public static void eachByte(InputStream is, int bufferLen, Closure closure)


eachByte

@Deprecated
public static void eachByte(URL url, Closure closure)


eachByte

@Deprecated
public static void eachByte(URL url, int bufferLen, Closure closure)


eachDir

@Deprecated
public static void eachDir(File self, Closure closure)


eachDirMatch

@Deprecated
public static void eachDirMatch(File self, Object nameFilter, Closure closure)


eachDirRecurse

@Deprecatedreturn ResourceGroovyMethods.newWriter(file, append);
public static void eachDirRecurse(File self, Closure closure)


eachFile

@Deprecated}
public static void eachFile(File self, FileType fileType, Closure closure)


eachFile

@Deprecated
public static void eachFile(File self, Closure closure)


eachFileMatch

@Deprecatedreturn ResourceGroovyMethods.newWriter(file, charset, append);
public static void eachFileMatch(File self, FileType fileType, Object nameFilter, Closure closure)


eachFileMatch

@Deprecated}
public static void eachFileMatch(File self, Object nameFilter, Closure closure)


eachFileRecurse

@Deprecated
public static void eachFileRecurse(File self, FileType fileType, Closure closure)


eachFileRecurse

@Deprecatedreturn ResourceGroovyMethods.newWriter(file);
public static void eachFileRecurse(File self, Closure closure)


eachLine

@Deprecated
public static Object eachLine(CharSequence self, Closure closure)


eachLine

@Deprecated
public static Object eachLine(CharSequence self, int firstLine, Closure closure)


eachLine

@Deprecated
public static Object eachLine(String self, Closure closure)


eachLine

@Deprecated
public static Object eachLine(String self, int firstLine, Closure closure)


eachLine

@Deprecated
public static Object eachLine(File self, Closure closure)


eachLine

@Deprecated
public static Object eachLine(File self, String charset, Closure closure)


eachLine

@Deprecated
public static Object eachLine(File self, int firstLine, Closure closure)


eachLine

@Deprecated
public static Object eachLine(File self, String charset, int firstLine, Closure closure)


eachLine

@Deprecated
public static Object eachLine(InputStream stream, String charset, Closure closure)


eachLine

@Deprecated
public static Object eachLine(InputStream stream, String charset, int firstLine, Closure closure)


eachLine

@Deprecated
public static Object eachLine(InputStream stream, Closure closure)


eachLine

@Deprecated
public static Object eachLine(InputStream stream, int firstLine, Closure closure)


eachLine

@Deprecated
public static Object eachLine(URL url, Closure closure)


eachLine

@Deprecated
public static Object eachLine(URL url, int firstLine, Closure closure)


eachLine

@Deprecated
public static Object eachLine(URL url, String charset, Closure closure)


eachLine

@Deprecated
public static Object eachLine(URL url, String charset, int firstLine, Closure closure)


eachLine

@Deprecated
public static Object eachLine(Reader self, Closure closure)


eachLine

@Deprecated
public static Object eachLine(Reader self, int firstLine, Closure closure)


eachMatch

@Deprecated
public static String eachMatch(CharSequence self, CharSequence regex, Closure closure)


eachMatch

@Deprecated
public static String eachMatch(CharSequence self, Pattern pattern, Closure closure)


eachMatch

@Deprecated
public static String eachMatch(String self, Pattern pattern, Closure closure)


eachMatch

@Deprecated
public static String eachMatch(String self, String regex, Closure closure)


eachObject

@Deprecated
public static void eachObject(File self, Closure closure)


eachObject

@Deprecated
public static void eachObject(ObjectInputStream ois, Closure closure)


eachPermutation

public static Iterator eachPermutation(Collection self, Closure closure)


eachWithIndex

public static Object eachWithIndex(Object self, Closure closure)


eachWithIndex

public static Map eachWithIndex(Map self, Closure closure)


equals

public static boolean equals(int[] left, int[] right)
Determines if the contents of this array are equal to the contents of the given list, in the same order. This returns false if either collection is null.
Parameters:
left - an array
right - the List being compared
Returns:
true if the contents of both collections are equal
Since:
1.5.0


equals

public static boolean equals(Object[] left, List right)


equals

public static boolean equals(List left, Object[] right)


equals

public static boolean equals(List left, List right)


equals

public static boolean equals(Set self, Set other)


equals

public static boolean equals(Map self, Map other)
Create a Set composed of the elements of the first Set minus the elements of the given Collection.
Parameters:
self - a Set object
removeMe - the items to remove from the Set
Returns:
the resulting Set
Since:
1.5.0


every

public static boolean every(Object self, Closure closure)


every

public static boolean every(Map self, Closure closure)


every

public static boolean every(Object self)


execute

@Deprecated
public static Process execute(String self)


execute

@Deprecated
public static Process execute(String self, String[] envp, File dir)


execute

@Deprecated
public static Process execute(String self, List envp, File dir)


execute

@Deprecated
public static Process execute(String[] commandArray)


execute

@Deprecated
public static Process execute(String[] commandArray, String[] envp, File dir)


execute

@Deprecated
public static Process execute(String[] commandArray, List envp, File dir)


execute

@Deprecated
public static Process execute(List commands)


execute

@Deprecated
public static Process execute(List commands, String[] envp, File dir)


execute

@Deprecated
public static Process execute(List commands, List envp, File dir)


expand

@Deprecated
public static CharSequence expand(CharSequence self)


expand

@Deprecated
public static CharSequence expand(CharSequence self, int tabStop)


expand

@Deprecated
public static String expand(String self)


expand

@Deprecated
public static String expand(String self, int tabStop)


expandLine

@Deprecated
public static CharSequence expandLine(CharSequence self, int tabStop)


expandLine

@Deprecated
public static String expandLine(String self, int tabStop)


filterLine

@Deprecated
public static void filterLine(Reader reader, Writer writer, Closure closure)


filterLine

@Deprecated
public static Writable filterLine(File self, Closure closure)


filterLine

@Deprecated
public static Writable filterLine(File self, String charset, Closure closure)


filterLine

@Deprecated
public static void filterLine(File self, Writer writer, Closure closure)


filterLine

@Deprecated
public static void filterLine(File self, Writer writer, String charset, Closure closure)


filterLine

@Deprecated
public static Writable filterLine(Reader reader, Closure closure)


filterLine

@Deprecated
public static Writable filterLine(InputStream self, Closure predicate)


filterLine

@Deprecated
public static Writable filterLine(InputStream self, String charset, Closure predicate)


filterLine

@Deprecated
public static void filterLine(InputStream self, Writer writer, Closure predicate)


filterLine

@Deprecated
public static void filterLine(InputStream self, Writer writer, String charset, Closure predicate)


filterLine

@Deprecated
public static Writable filterLine(URL self, Closure predicate)


filterLine

@Deprecated
public static Writable filterLine(URL self, String charset, Closure predicate)


filterLine

@Deprecated
public static void filterLine(URL self, Writer writer, Closure predicate)


filterLine

@Deprecated
public static void filterLine(URL self, Writer writer, String charset, Closure predicate)


find

public static Object find(Object self, Closure closure)


find

public static Object find(Object self)
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.
Parameters:
self - an Object with an iterator returning its values
defaultResult - an Object that should be returned if all closure results are null
closure - a closure that returns a non-null value when processing should stop
Returns:
the first non-null result of the closure, otherwise the default value
Since:
1.7.5


find

public static Object find(Collection self, Closure closure)


find

public static Object find(Object[] self, Closure condition)


find

public static Object find(Collection self)


find

public static Map.Entry find(Map self, Closure closure)


find

@Deprecated
public static CharSequence find(CharSequence self, CharSequence regex)


find

@Deprecated
public static CharSequence find(CharSequence self, CharSequence regex, Closure closure)


find

@Deprecated
public static CharSequence find(CharSequence self, Pattern pattern)


find

@Deprecated
public static CharSequence find(CharSequence self, Pattern pattern, Closure closure)


find

@Deprecated
public static String find(String self, Pattern pattern)


find

@Deprecated
public static String find(String self, Pattern pattern, Closure closure)


find

@Deprecated
public static String find(String self, String regex)


find

@Deprecated
public static String find(String self, String regex, Closure closure)


findAll

public static Collection findAll(Collection self, Closure closure)
Finds all elements of the array matching the given Closure condition.
 def items = [1,2,3,4] as Integer[]
 assert [2,4] == items.findAll { it % 2 == 0 }
 
Parameters:
self - an array
condition - a closure condition
Returns:
a list of matching values
Since:
2.0


findAll

public static Collection findAll(Object[] self, Closure condition)


findAll

public static Collection findAll(Collection self)
Finds the elements of the array matching the IDENTITY Closure (i.e. matching Groovy truth).

Example:

 def items = [1, 2, 0, false, true, '', 'foo', [], [4, 5], null] as Object[]
 assert items.findAll() == [1, 2, true, 'foo', [4, 5]]
 
Parameters:
self - an array
Returns:
a collection of the elements found
See Also:
Closure.IDENTITY
Since:
2.0


findAll

public static Collection findAll(Object[] self)
Finds all items matching the closure condition.
Parameters:
self - an Object with an Iterator returning its values
closure - a closure condition
Returns:
a List of the values found
Since:
1.6.0


findAll

public static Collection findAll(Object self, Closure closure)


findAll

public static Collection findAll(Object self)


findAll

public static Map findAll(Map self, Closure closure)


findAll

@Deprecated
public static List findAll(CharSequence self, CharSequence regex)


findAll

@Deprecated
public static List findAll(CharSequence self, CharSequence regex, Closure closure)


findAll

@Deprecated
public static List findAll(CharSequence self, Pattern pattern)


findAll

@Deprecated
public static List findAll(CharSequence self, Pattern pattern, Closure closure)


findAll

@Deprecated
public static List findAll(String self, Pattern pattern)


findAll

@Deprecated
public static List findAll(String self, Pattern pattern, Closure closure)


findAll

@Deprecated
public static List findAll(String self, String regex)


findAll

@Deprecated
public static List findAll(String self, String regex, Closure closure)


findIndexOf

public static int findIndexOf(Object self, Closure closure)


findIndexOf

public static int findIndexOf(Object self, int startIndex, Closure closure)


findIndexValues

public static List findIndexValues(Object self, Closure closure)


findIndexValues

public static List findIndexValues(Object self, Number startIndex, Closure closure)


findLastIndexOf

public static int findLastIndexOf(Object self, Closure closure)
Converts a given object to a type. This method is used through the "as" operator and is overloadable as any other operator.
Parameters:
obj - the object to convert
type - the goal type
Returns:
the resulting object
Since:
1.0


findLastIndexOf

public static int findLastIndexOf(Object self, int startIndex, Closure closure)


findResult

public static Object findResult(Object self, Object defaultResult, Closure closure)
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.
Parameters:
self - an Object with an iterator returning its values
closure - a closure that returns a non-null value when processing should stop
Returns:
the first non-null result of the closure
Since:
1.7.5


findResult

public static Object findResult(Object self, Closure closure)


findResult

public static Object findResult(Collection self, Object defaultResult, Closure closure)


findResult

public static Object findResult(Collection self, Closure closure)


findResult

public static Object findResult(Map self, Object defaultResult, Closure closure)


findResult

public static Object findResult(Map self, Closure closure)


findResults

public static Collection findResults(Collection self, Closure filteringTransform)


findResults

public static Collection findResults(Map self, Closure filteringTransform)


first

public static Object first(List self)


first

public static Object first(Iterable self)
Returns the first item from the array.
 def array = [3, 4, 2].toArray()
 assert array.first() == 3
 
throws:
NoSuchElementException if the array is empty and you try to access the first() item.
Parameters:
self - an array
Returns:
the first item from the array
Since:
1.7.3


first

public static Object first(Object[] self)


flatten

public static Collection flatten(Collection self)
Flatten an array. This array and any nested arrays or collections have their contents (recursively) added to the new collection.
Parameters:
self - a byte Array to flatten
Returns:
a flattened Collection
Since:
1.6.0


flatten

public static Collection flatten(Object[] self)


flatten

public static Collection flatten(boolean[] self)


flatten

public static Collection flatten(byte[] self)


flatten

public static Collection flatten(char[] self)


flatten

public static Collection flatten(short[] self)


flatten

public static Collection flatten(int[] self)


flatten

public static Collection flatten(long[] self)


flatten

public static Collection flatten(float[] self)
Flatten a collection. This collection and any nested arrays or collections have their contents (recursively) added to the new collection. For any non-Array, non-Collection object which represents some sort of collective type, the supplied closure should yield the contained items; otherwise, the closure should just return any element which corresponds to a leaf.
Parameters:
self - a Collection
flattenUsing - a closure to determine how to flatten non-Array, non-Collection elements
Returns:
a flattened Collection
Since:
1.6.0


flatten

public static Collection flatten(double[] self)


flatten

public static Collection flatten(Collection self, Closure flattenUsing)
Overloads the left shift operator to provide an easy way to append objects to a Collection.
def list = [1,2]
 list << 3
 assert list == [1,2,3]
Parameters:
self - a Collection
value - an Object to be added to the collection.
Returns:
same collection, after the value was added to it.
Since:
1.0


get

public static Object get(Map map, Object key, Object defaultValue)
Support the range subscript operator for an Array
Parameters:
array - an Array of Objects
range - a Range
Returns:
a range of a list from the range's from index up to but not including the range's to value
Since:
1.0


getAt

public static Object getAt(Object self, String property)
Allows the subscript operator to be used to lookup dynamic property values. bean[somePropertyNameExpression]. The normal property notation of groovy is neater and more concise but only works with compile-time known property names.
Parameters:
self - the object to act upon
property - the property name of interest
Returns:
the property value
Since:
1.0


getAt

public static List getAt(List self, Range range)
Support the range subscript operator for a List.
def list = [true, 1, 3.4]
 assert list[0..<0] == []
Parameters:
self - a List
range - a Range indicating the items to get
Returns:
a sublist based on range borders or a new list if range is reversed
See Also:
List.subList
Since:
1.0


getAt

public static List getAt(List self, EmptyRange range)
Select a List of items from a List using a Collection to identify the indices to be selected.
def list = [true, 1, 3.4, false]
 assert list[1,0,2] == [1, true, 3.4]
Parameters:
self - a List
indices - a Collection of indices
Returns:
a new list of the values at the given indices
Since:
1.0


getAt

public static List getAt(List self, Collection indices)
Select a List of items from an Object array using a Collection to identify the indices to be selected.
Parameters:
self - an Array of Objects
indices - a Collection of indices
Returns:
a new list of the values at the given indices
Since:
1.0


getAt

public static List getAt(Object[] self, Collection indices)
Creates a sub-Map containing the given keys. This method is similar to List.subList() but uses keys rather than index ranges.
assert [1:10, 2:20, 4:40].subMap( [2, 4] ) == [2:20, 4:40]
Parameters:
map - a Map
keys - a Collection of keys
Returns:
a new Map containing the given keys
Since:
1.0


getAt

public static List getAt(Object[] array, Range range)
Parameters:
array - an Array of Objects
range - an EmptyRange
Returns:
an empty Range
Since:
1.5.0


getAt

public static List getAt(Object[] array, IntRange range)
Parameters:
array - an Array of Objects
range - an ObjectRange
Returns:
a range of a list from the range's from index up to but not including the range's to value
Since:
1.0


getAt

public static List getAt(Object[] array, EmptyRange range)


getAt

public static List getAt(Object[] array, ObjectRange range)


getAt

public static Object getAt(List self, int idx)


getAt

public static Object getAt(Iterator self, int idx)


getAt

public static Object getAt(Iterable self, int idx)
A helper method to allow lists to work with subscript operators.
def list = [2, 3]
 list[0] = 1
 assert list == [1, 3]
Parameters:
self - a List
idx - an index
value - the value to put at the given index
Since:
1.0


getAt

public static Object getAt(Map self, Object key)
Support the subscript operator for a Map.
def map = [a:10]
 assert map["a"] == 10
Parameters:
self - a Map
key - an Object as a key for the map
Returns:
the value corresponding to the given key
Since:
1.0


getAt

public static List getAt(Collection coll, String property)
A convenience method for creating an immutable map.
Parameters:
self - a Map
Returns:
an immutable Map
See Also:
Collections.unmodifiableMap
Since:
1.0


getAt

@SuppressWarnings* Support the subscript operator with a range for a long array
public static List getAt(byte[] array, Range range)
Support the subscript operator with a range for an int array
Parameters:
array - an int array
range - a range indicating the indices for the items to retrieve
Returns:
list of the ints at the given indices
Since:
1.0


getAt

@SuppressWarnings* Support the subscript operator with a range for a float array
public static List getAt(char[] array, Range range)


getAt

@SuppressWarnings* Support the subscript operator with a range for a double array
public static List getAt(short[] array, Range range)


getAt

@SuppressWarnings* Support the subscript operator with a range for a boolean array
public static List getAt(int[] array, Range range)


getAt

@SuppressWarnings* Support the subscript operator with an IntRange for a byte array
public static List getAt(long[] array, Range range)


getAt

@SuppressWarnings* Support the subscript operator with an IntRange for a char array
public static List getAt(float[] array, Range range)


getAt

@SuppressWarnings* Support the subscript operator with an IntRange for a short array
public static List getAt(double[] array, Range range)


getAt

@SuppressWarnings* Support the subscript operator with an IntRange for an int array
public static List getAt(boolean[] array, Range range)


getAt

@SuppressWarnings* Support the subscript operator with an IntRange for a long array
public static List getAt(byte[] array, IntRange range)


getAt

@SuppressWarnings* Support the subscript operator with an IntRange for a float array
public static List getAt(char[] array, IntRange range)


getAt

@SuppressWarnings* Support the subscript operator with an IntRange for a double array
public static List getAt(short[] array, IntRange range)


getAt

@SuppressWarnings* Support the subscript operator with an IntRange for a boolean array
public static List getAt(int[] array, IntRange range)


getAt

@SuppressWarnings* Support the subscript operator with an ObjectRange for a byte array
public static List getAt(long[] array, IntRange range)


getAt

@SuppressWarnings* Support the subscript operator with an ObjectRange for a char array
public static List getAt(float[] array, IntRange range)


getAt

@SuppressWarnings* Support the subscript operator with an ObjectRange for a short array
public static List getAt(double[] array, IntRange range)


getAt

@SuppressWarnings* Support the subscript operator with an ObjectRange for an int array
public static List getAt(boolean[] array, IntRange range)


getAt

@SuppressWarnings* Support the subscript operator with an ObjectRange for a long array
public static List getAt(byte[] array, ObjectRange range)


getAt

@SuppressWarnings* Support the subscript operator with an ObjectRange for a float array
public static List getAt(char[] array, ObjectRange range)


getAt

@SuppressWarnings* Support the subscript operator with an ObjectRange for a double array
public static List getAt(short[] array, ObjectRange range)


getAt

@SuppressWarnings* Support the subscript operator with an ObjectRange for a byte array
public static List getAt(int[] array, ObjectRange range)


getAt

@SuppressWarnings* Support the subscript operator with a collection for a byte array
public static List getAt(long[] array, ObjectRange range)


getAt

@SuppressWarnings* Support the subscript operator with a collection for a char array
public static List getAt(float[] array, ObjectRange range)


getAt

@SuppressWarnings* Support the subscript operator with a collection for a short array
public static List getAt(double[] array, ObjectRange range)


getAt

@SuppressWarnings* Support the subscript operator with a collection for an int array
public static List getAt(boolean[] array, ObjectRange range)


getAt

@SuppressWarnings* Support the subscript operator with a collection for a long array
public static List getAt(byte[] array, Collection indices)


getAt

@SuppressWarnings* Support the subscript operator with a collection for a float array
public static List getAt(char[] array, Collection indices)


getAt

@SuppressWarnings* Support the subscript operator with a collection for a double array
public static List getAt(short[] array, Collection indices)


getAt

@SuppressWarnings* Support the subscript operator with a collection for a boolean array
public static List getAt(int[] array, Collection indices)


getAt

@SuppressWarnings* Support the subscript operator for a Bitset
public static List getAt(long[] array, Collection indices)


getAt

@SuppressWarnings* Support retrieving a subset of a BitSet using a Range
public static List getAt(float[] array, Collection indices)


getAt

@SuppressWarningsBitSet result = new BitSet();
public static List getAt(double[] array, Collection indices)


getAt

@SuppressWarnings}
public static List getAt(boolean[] array, Collection indices)


getAt

public static boolean getAt(BitSet self, int index)


getAt

public static BitSet getAt(BitSet self, IntRange range)


getAt

@Deprecated
public static CharSequence getAt(CharSequence self, Collection indices)


getAt

@Deprecated
public static CharSequence getAt(CharSequence text, EmptyRange range)


getAt

@Deprecated
public static CharSequence getAt(CharSequence text, int index)


getAt

@Deprecated
public static CharSequence getAt(CharSequence text, IntRange range)


getAt

@Deprecated
public static CharSequence getAt(CharSequence text, Range range)


getAt

@Deprecated
public static List getAt(Matcher self, Collection indices)


getAt

@Deprecated
public static Object getAt(Matcher matcher, int idx)


getAt

@Deprecated
public static String getAt(String self, Collection indices)


getAt

@Deprecated
public static String getAt(String text, EmptyRange range)


getAt

@Deprecated
public static String getAt(String text, int index)


getAt

@Deprecated
public static String getAt(String text, IntRange range)


getAt

@Deprecated
public static String getAt(String text, Range range)


getBytes

@Deprecatedpublic static void eachFileMatch(final File self, final FileType fileType, final Object nameFilter, final Closure closure)
public static byte[] getBytes(File file)


getBytes

@Deprecated
public static byte[] getBytes(URL url)


getBytes

@Deprecated
public static byte[] getBytes(InputStream is)


getChars

@Deprecated
public static char[] getChars(CharSequence self)


getChars

@Deprecated
public static char[] getChars(String self)


getCount

@Deprecated
public static int getCount(Matcher matcher)


getMetaClass

public static MetaClass getMetaClass(Class c)


getMetaClass

public static MetaClass getMetaClass(Object obj)


getMetaClass

public static MetaClass getMetaClass(GroovyObject obj)
Sets/updates the metaclass for a given object to a closure.
throws:
GroovyRuntimeException if the metaclass can't be set for this object
Parameters:
self - the object whose metaclass we wish to update
closure - the closure representing the new metaclass
Returns:
the new metaclass value
Since:
1.6.0


getMetaPropertyValues

public static List getMetaPropertyValues(Object self)
Retrieves the list of MetaProperty objects for 'self' and wraps it in a list of PropertyValue objects that additionally provide the value for each property of 'self'.
Parameters:
self - the receiver object
Returns:
list of PropertyValue objects
See Also:
Expando.getMetaPropertyValues
Since:
1.0


getProperties

public static Map getProperties(Object self)
Convenience method that calls getMetaPropertyValues(java.lang.Object)(self) and provides the data in form of simple key/value pairs, i.e.&nsbp;without type() information.
Parameters:
self - the receiver object
Returns:
meta properties as Map of key/value pairs
Since:
1.0


getRootLoader

public static ClassLoader getRootLoader(ClassLoader self)
Convenience method to dynamically create a new instance of this class. Calls the default constructor.
Parameters:
c - a class
Returns:
a new instance of this class
Since:
1.0


getSubList

protected static List getSubList(List self, List splice)


getText

@Deprecated
public static String getText(File file, String charset)


getText

@Deprecated
public static String getText(File file)


getText

@Deprecated
public static String getText(URL url)


getText

@Deprecated
public static String getText(URL url, Map parameters)


getText

@Deprecated}
public static String getText(URL url, String charset)


getText

@DeprecatedResourceGroovyMethods.traverse(self, options, closure);
public static String getText(URL url, Map parameters, String charset)


getText

@DeprecatedResourceGroovyMethods.traverse(self, closure);
public static String getText(InputStream is)


getText

@Deprecatedthrows FileNotFoundException, IllegalArgumentException {
public static String getText(InputStream is, String charset)


getText

@Deprecatedpublic static void eachFileRecurse(File self, Closure closure) throws FileNotFoundException, IllegalArgumentException {
public static String getText(Reader reader)


getText

@Deprecatedpublic static void eachDirRecurse(final File self, final Closure closure) throws FileNotFoundException, IllegalArgumentException {
public static String getText(BufferedReader reader)


grep

public static Collection grep(Object self, Object filter)


grep

public static Collection grep(Collection self, Object filter)
Iterates over the collection of items and returns each item that matches the given filter - calling the isCase(java.lang.Object, java.lang.Object) method used by switch statements. This method can be used with different kinds of filters like regular expressions, classes, ranges etc. Example:
 def list = ['a', 'b', 'aa', 'bc', 3, 4.5]
 assert list.grep( ~/a+/ )  == ['a', 'aa']
 assert list.grep( ~/../ )  == ['aa', 'bc']
 assert list.grep( Number ) == [ 3, 4.5 ]
 assert list.grep{ it.toString().size() == 1 } == [ 'a', 'b', 3 ]
 
Parameters:
self - a collection
filter - the filter to perform on each element of the collection (using the isCase(java.lang.Object, java.lang.Object) method)
Returns:
a collection of objects which match the filter
Since:
2.0


grep

public static Collection grep(Object[] self, Object filter)


grep

public static Collection grep(Object self)


grep

@SuppressWarnings* assert items.grep() == [1, 2, true, 'foo', [4, 5]]
public static Collection grep(Collection self)


grep

@SuppressWarnings* @param self  the Iterator from which we count the number of matching occurrences
public static Collection grep(Object[] self)


groupAnswer

protected static void groupAnswer(Map answer, Object element, Object value)


groupBy

public static Map groupBy(Collection self, Closure closure)


groupBy

public static Map groupBy(Collection self, Object... closures)


groupBy

public static Map groupBy(Collection self, List closures)
Sorts all collection members into (sub)groups determined by the supplied mapping closures. Each closure should return the key that this item should be grouped by. The returned LinkedHashMap will have an entry for each distinct 'key path' returned from the closures, with each value being a list of items for that 'group path'.

Example usage:

def result = [1,2,3,4,5,6].groupBy([{ it % 2 }, { it < 4 }])
 assert result == [1:[(true):[1, 3], (false):[5]], 0:[(true):[2], (false):[4, 6]]]
Another example:
def sql = groovy.sql.Sql.newInstance(/* ... */)
 def data = sql.rows("SELECT * FROM a_table").groupBy([{ it.column1 }, { it.column2 }, { it.column3 }])
 if (data.val1.val2.val3) {
     // there exists a record where:
     //   a_table.column1 == val1
     //   a_table.column2 == val2, and
     //   a_table.column3 == val3
 } else {
     // there is no such record
 }
If an empty list of closures is supplied the IDENTITY Closure will be used.
Parameters:
self - a collection to group
closures - a list of closures, each mapping entries on keys
Returns:
a new Map grouped by keys on each criterion
See Also:
Closure.IDENTITY
Since:
1.8.1


groupBy

public static Map groupBy(Map self, Closure closure)


groupBy

public static Map groupBy(Map self, Object... closures)


groupBy

public static Map groupBy(Map self, List closures)
Groups the members of a map into sub maps determined by the supplied mapping closures. Each closure will be passed a Map.Entry or key and value (depending on the number of parameters the closure accepts) and should return the key that each item should be grouped under. The resulting map will have an entry for each 'group path' returned by all closures, with values being the map members from the original map that belong to each such 'group path'.

If the self map is one of TreeMap, Hashtable, or Properties, the returned Map will preserve that type, otherwise a LinkedHashMap will be returned.

def result = [a:1,b:2,c:3,d:4,e:5,f:6].groupBy([{ it.value % 2 }, { it.key.next() }])
 assert result == [1:[b:[a:1], d:[c:3], f:[e:5]], 0:[c:[b:2], e:[d:4], g:[f:6]]]
If an empty list of closures is supplied the IDENTITY Closure will be used.
Parameters:
self - a map to group
closures - a list of closures that map entries on keys
Returns:
a new map grouped by keys on each criterion
See Also:
Closure.IDENTITY
Since:
1.8.1


groupEntriesBy

public static Map groupEntriesBy(Map self, Closure closure)


hasGroup

@Deprecated
public static boolean hasGroup(Matcher matcher)


hasProperty

public static MetaProperty hasProperty(Object self, String name)


head

public static Object head(List self)
Returns the items from the List excluding the first item.
def list = [3, 4, 2]
 assert list.tail() == [4, 2]
 assert list == [3, 4, 2]
throws:
NoSuchElementException if the list is empty and you try to access the tail() item.
Parameters:
self - a List
Returns:
a list without its first element
Since:
1.5.6


head

public static Object head(Object[] self)


identity

public static Object identity(Object self, Closure closure)


implies

public static Boolean implies(Boolean left, Boolean right)


inject

public static Object inject(Collection self, Closure closure)


inject

public static Object inject(Collection self, Object initialValue, Closure closure)


inject

public static Object inject(Map self, Object initialValue, Closure closure)


inject

public static Object inject(Iterator self, Object initialValue, Closure closure)


inject

public static Object inject(Object self, Closure closure)
Iterates through the given Object, passing in the initial value to the closure along with the first item. The result is passed back (injected) into the closure along with the second item. The new result is injected back into the closure along with the third item and so on until further iteration of the object is not possible. Also known as foldLeft in functional parlance.
Parameters:
self - an Object
initialValue - some initial value
closure - a closure
Returns:
the result of the last closure call
See Also:
inject(Collection, Object, Closure)
Since:
1.5.0


inject

public static Object inject(Object self, Object initialValue, Closure closure)
Iterates through the given array as with inject(Object[],initialValue,closure), but using the first element of the array as the initialValue, and then iterating the remaining elements of the array.
throws:
NoSuchElementException if the array is empty.
Parameters:
self - an Object[]
closure - a closure
Returns:
the result of the last closure call
See Also:
inject(Object[], Object, Closure)
Since:
1.8.7


inject

public static Object inject(Object[] self, Closure closure)


inject

public static Object inject(Object[] self, Object initialValue, Closure closure)
Sums the items in a collection. This is equivalent to invoking the "plus" method on all items in the collection.
assert 1+2+3+4 == [1,2,3,4].sum()
Parameters:
self - Collection of values to add together
Returns:
The sum of all of the items
Since:
1.0


inspect

public static String inspect(Object self)
Inspects returns the String that matches what would be typed into a terminal to create this object.
Parameters:
self - any Object
Returns:
a String that matches what would be typed into a terminal to create this object. e.g. [1, 'hello'].inspect() -> [1, "hello"]
Since:
1.0


intdiv

public static Number intdiv(Character left, Number right)
Bitwise NEGATE a BitSet.
Parameters:
self - a BitSet
Returns:
the bitwise NEGATE of the BitSet
Since:
1.5.0


intdiv

public static Number intdiv(Number left, Character right)
Bitwise OR together two BitSets. Called when the '|' operator is used between two bit sets.
Parameters:
left - a BitSet
right - another BitSet to bitwise AND
Returns:
the bitwise OR of both BitSets
Since:
1.5.0


intdiv

public static Number intdiv(Character left, Character right)
Bitwise XOR together two Numbers. Called when the '|' operator is used.
Parameters:
left - a Number
right - another Number to bitwse XOR
Returns:
the bitwise XOR of both Numbers
Since:
1.0


intdiv

public static Number intdiv(Number left, Number right)


intersect

public static Collection intersect(Collection left, Collection right)


intersect

public static Map intersect(Map left, Map right)
Returns true if the intersection of two collections is empty.
assert [1,2,3].disjoint([3,4,5]) == false
assert [1,2].disjoint([3,4]) == true
Parameters:
left - a Collection
right - a Collection
Returns:
boolean true if the intersection of two collections is empty, false otherwise.
Since:
1.0


invokeMethod

public static Object invokeMethod(Object object, String method, Object arguments)


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 object
other - an object to compare identity with
Returns:
true if self and other are both references to the same instance, false otherwise
Since:
1.0


isAllWhitespace

@Deprecated
public static boolean isAllWhitespace(CharSequence self)


isAllWhitespace

@Deprecated
public static boolean isAllWhitespace(String self)


isBigDecimal

@Deprecated
public static boolean isBigDecimal(CharSequence self)


isBigDecimal

@Deprecated
public static boolean isBigDecimal(String self)


isBigInteger

@Deprecated
public static boolean isBigInteger(CharSequence self)


isBigInteger

@Deprecated
public static boolean isBigInteger(String self)


isCase

public static boolean isCase(Object caseValue, Object switchValue)


isCase

public static boolean isCase(Class caseValue, Object switchValue)


isCase

public static boolean isCase(Collection caseValue, Object switchValue)


isCase

public static boolean isCase(Map caseValue, Object switchValue)


isCase

public static boolean isCase(Number caseValue, Number switchValue)


isCase

@Deprecated
public static boolean isCase(CharSequence caseValue, Object switchValue)


isCase

@Deprecated
public static boolean isCase(GString caseValue, Object switchValue)


isCase

@Deprecated
public static boolean isCase(Pattern caseValue, Object switchValue)


isCase

@Deprecated
public static boolean isCase(String caseValue, Object switchValue)


isDigit

public static boolean isDigit(Character self)


isDouble

@Deprecated
public static boolean isDouble(CharSequence self)


isDouble

@Deprecated
public static boolean isDouble(String self)


isFloat

@Deprecated
public static boolean isFloat(CharSequence self)


isFloat

@Deprecated
public static boolean isFloat(String self)


isInteger

@Deprecated
public static boolean isInteger(CharSequence self)


isInteger

@Deprecated
public static boolean isInteger(String self)


isLetter

public static boolean isLetter(Character self)
Transform a Number into a Double
Parameters:
self - a Number
Returns:
an Double
Since:
1.0


isLetterOrDigit

public static boolean isLetterOrDigit(Character self)
Transform a Number into a BigDecimal
Parameters:
self - a Number
Returns:
an BigDecimal
Since:
1.0


isLong

@Deprecated
public static boolean isLong(CharSequence self)


isLong

@Deprecated
public static boolean isLong(String self)


isLowerCase

public static boolean isLowerCase(Character self)
Transform a Number into a Float
Parameters:
self - a Number
Returns:
an Float
Since:
1.0


isNumber

@Deprecated
public static boolean isNumber(CharSequence self)


isNumber

@Deprecated
public static boolean isNumber(String self)


isUpperCase

public static boolean isUpperCase(Character self)


isWhitespace

public static boolean isWhitespace(Character self)


iterator

public static Iterator iterator(Object[] a)


iterator

public static Iterator iterator(Object o)


iterator

public static Iterator iterator(Enumeration enumeration)


iterator

public static Iterator iterator(Iterator self)


iterator

@Deprecated
public static Iterator iterator(Matcher matcher)


iterator

@Deprecated
public static Iterator iterator(Reader self)


iterator

@Deprecated
public static Iterator iterator(InputStream self)


iterator

@Deprecated
public static Iterator iterator(DataInputStream self)


join

public static String join(Iterator self, String separator)
Concatenates the toString() representation of each item in this collection, with the given String as a separator between each item.
assert "1, 2, 3" == [1,2,3].join(", ")
Parameters:
self - a Collection of objects
separator - a String separator
Returns:
the joined String
Since:
1.0


join

public static String join(Collection self, String separator)


join

public static String join(Object[] self, String separator)


last

public static Object last(List self)


last

public static Object last(Iterable self)
Returns the last item from the array.
 def array = [3, 4, 2].toArray()
 assert array.last() == 2
 
throws:
NoSuchElementException if the array is empty and you try to access the last() item.
Parameters:
self - an array
Returns:
the last item from the array
Since:
1.7.3


last

public static Object last(Object[] self)
Returns the first item from the List.
 def list = [3, 4, 2]
 assert list.first() == 3
 // check original is unaltered
 assert list == [3, 4, 2]
 
throws:
NoSuchElementException if the list is empty and you try to access the first() item.
Parameters:
self - a List
Returns:
the first item from the List
Since:
1.5.5


leftShift

public static Collection leftShift(Collection self, Object value)
Overloads the left shift operator to provide an easy way to append Map.Entry values to a Map.
Parameters:
self - a Map
entry - a Map.Entry to be added to the Map.
Returns:
same map, after the value has been added to it.
Since:
1.6.0


leftShift

public static BlockingQueue leftShift(BlockingQueue self, Object value)


leftShift

public static Map leftShift(Map self, Map.Entry entry)


leftShift

public static Map leftShift(Map self, Map other)
Implementation of the right shift (unsigned) operator for integral types. Non integral Number types throw UnsupportedOperationException.
Parameters:
self - a Number object
operand - the shift distance by which to right shift (unsigned) the number
Returns:
the resulting number
Since:
1.5.0


leftShift

public static Number leftShift(Number self, Number operand)
Support the subscript operator with a range for a byte array
Parameters:
array - a byte array
range - a range indicating the indices for the items to retrieve
Returns:
list of the retrieved bytes
Since:
1.0


leftShift

@Deprecated
public static StringBuilder leftShift(CharSequence self, Object value)


leftShift

@Deprecated
public static StringBuffer leftShift(String self, Object value)


leftShift

@Deprecated
public static StringBuffer leftShift(StringBuffer self, Object value)


leftShift

@Deprecated
public static StringBuilder leftShift(StringBuilder self, Object value)


leftShift

@Deprecated
public static Writer leftShift(Socket self, Object value)


leftShift

@Deprecated
public static OutputStream leftShift(Socket self, byte[] value)


leftShift

@Deprecated
public static Writer leftShift(Writer self, Object value)


leftShift

@Deprecated
public static Writer leftShift(OutputStream self, Object value)


leftShift

@Deprecated
public static void leftShift(ObjectOutputStream self, Object value)


leftShift

@Deprecated
public static OutputStream leftShift(OutputStream self, InputStream in)


leftShift

@Deprecated
public static OutputStream leftShift(OutputStream self, byte[] value)


leftShift

@Deprecated
public static File leftShift(File file, Object text)


leftShift

@Deprecated
public static File leftShift(File file, byte[] bytes)


leftShift

@Deprecated
public static File leftShift(File file, InputStream data)


matches

@Deprecated
public static boolean matches(CharSequence self, Pattern pattern)


matches

@Deprecated
public static boolean matches(String self, Pattern pattern)


max

public static Map.Entry max(Map self, Closure closure)


max

public static Object max(Collection self)


max

public static Object max(Iterator self)


max

public static Object max(Object[] self)


max

public static Object max(Collection self, Closure closure)


max

public static Object max(Iterator self, Closure closure)
Selects the maximum value found from the Object array using the closure to determine the correct ordering. If the closure has two parameters it is used like a traditional Comparator. I.e. it should compare its two parameters for order, returning a negative integer, zero, or a positive integer when the first parameter is less than, equal to, or greater than the second respectively. Otherwise, the Closure is assumed to take a single parameter and return a Comparable (typically an Integer) which is then used for further comparison.
Parameters:
self - an Object array
closure - a Closure used to determine the correct ordering
Returns:
the maximum value
See Also:
max(java.util.Collection, groovy.lang.Closure)
Since:
1.5.5


max

public static Object max(Object[] self, Closure closure)
Selects the maximum value found in the collection using the given comparator.
assert "hello" == ["hello","hi","hey"].max( { a, b -> a.length() <=> b.length() } as Comparator )
Parameters:
self - a Collection
comparator - a Comparator
Returns:
the maximum value
Since:
1.0


max

public static Object max(Collection self, Comparator comparator)


max

public static Object max(Iterator self, Comparator comparator)
Provide the standard Groovy size() method for Iterator. The iterator will become exhausted of elements after determining the size value.
Parameters:
self - an Iterator
Returns:
the length of the Iterator
Since:
1.5.5


max

public static Object max(Object[] self, Comparator comparator)


metaClass

public static MetaClass metaClass(Class self, Closure closure)
Allows an Enumeration to behave like an Iterator. Note that the Iterator.remove method is unsupported since the underlying Enumeration does not provide a mechanism for removing items.
Parameters:
enumeration - an Enumeration object
Returns:
an Iterator for the given Enumeration
Since:
1.0


metaClass

public static MetaClass metaClass(Object self, Closure closure)
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.
Parameters:
self - an iterator object
Returns:
itself
Since:
1.5.0


min

public static Object min(Collection self)
Adds min() method to Iterator objects. The iterator will become exhausted of elements after determining the minimum value.
Parameters:
self - an Iterator
Returns:
the minimum value
See Also:
min(java.util.Collection)
Since:
1.5.5


min

public static Object min(Iterator self)


min

public static Object min(Object[] self)


min

public static Object min(Collection self, Comparator comparator)


min

public static Object min(Iterator self, Comparator comparator)


min

public static Object min(Object[] self, Comparator comparator)


min

public static Object min(Collection self, Closure closure)


min

public static Map.Entry min(Map self, Closure closure)


min

public static Object min(Iterator self, Closure closure)
Selects the minimum value found from the Object array using the closure to determine the correct ordering. If the closure has two parameters it is used like a traditional Comparator. I.e. it should compare its two parameters for order, returning a negative integer, zero, or a positive integer when the first parameter is less than, equal to, or greater than the second respectively. Otherwise, the Closure is assumed to take a single parameter and return a Comparable (typically an Integer) which is then used for further comparison.
Parameters:
self - an Object array
closure - a Closure used to determine the correct ordering
Returns:
the minimum value
See Also:
min(java.util.Collection, groovy.lang.Closure)
Since:
1.5.5


min

public static Object min(Object[] self, Closure closure)
Adds max() method to Collection objects.
assert 5 == [2,3,1,5,4].max()
Parameters:
self - a Collection
Returns:
the maximum value
See Also:
GroovyCollections.max
Since:
1.0


minus

public static Set minus(Set self, Collection removeMe)
Create a Set composed of the elements of the first Set minus the elements from the given Iterable.
Parameters:
self - a Set object
removeMe - the items to remove from the Set
Returns:
the resulting Set
Since:
1.8.7


minus

public static Set minus(Set self, Iterable removeMe)
Create an array composed of the elements of the first array minus the elements of the given Iterable.
Parameters:
self - an object array
removeMe - a Collection of elements to remove
Returns:
an array with the supplied elements removed
Since:
1.5.5


minus

public static Set minus(Set self, Object removeMe)
Create an array composed of the elements of the first array minus the elements of the given array.
Parameters:
self - an object array
removeMe - an array of elements to remove
Returns:
an array with the supplied elements removed
Since:
1.5.5


minus

@SuppressWarnings
public static Object[] minus(Object[] self, Iterable removeMe)
Create a List composed of the elements of the first list minus every occurrence of elements of the given Collection.
assert [1, "a", true, true, false, 5.3] - [true, 5.3] == [1, "a", false]
Parameters:
self - a List
removeMe - a Collection of elements to remove
Returns:
a List with the given elements removed
Since:
1.0


minus

@SuppressWarningsif (Number.class.isInstance(t)) {
public static Object[] minus(Object[] self, Object[] removeMe)


minus

public static List minus(List self, Collection removeMe)


minus

public static List minus(List self, Iterable removeMe)
Create a List composed of the elements of the first list minus every occurrence of elements of the given Iterable.
 class AbcIterable implements Iterable {
     Iterator iterator() { "abc".iterator() }
 }
 assert "backtrack".toList() - new AbcIterable() == ["k", "t", "r", "k"]
 
Parameters:
self - a List
removeMe - an Iterable of elements to remove
Returns:
a List with the supplied elements removed
Since:
1.8.7


minus

public static List minus(List self, Object removeMe)


minus

@SuppressWarnings/**
public static Object[] minus(Object[] self, Object removeMe)
Flatten a collection. This collection and any nested arrays or collections have their contents (recursively) added to the new collection.
assert [1,2,3,4,5] == [1,[2,3],[[4]],[],5].flatten()
Parameters:
self - a Collection to flatten
Returns:
a flattened Collection
Since:
1.6.0


minus

public static Map minus(Map self, Map removeMe)
Flatten an array. This array and any nested arrays or collections have their contents (recursively) added to the new collection.
Parameters:
self - an Array to flatten
Returns:
a flattened Collection
Since:
1.6.0


minus

public static Number minus(Character left, Number right)


minus

public static Number minus(Number left, Character right)
Power of a Number to a certain exponent. Called by the '**' operator.
Parameters:
self - a Number
exponent - a Number exponent
Returns:
a Number to the power of a certain exponent
Since:
1.0


minus

public static Number minus(Character left, Character right)


minus

@Deprecated
public static CharSequence minus(CharSequence self, Object target)


minus

@Deprecated
public static String minus(String self, Object target)


mixin

public static void mixin(MetaClass self, List categoryClasses)


mixin

public static void mixin(Class self, List categoryClasses)


mixin

public static void mixin(Class self, Class categoryClass)


mixin

public static void mixin(Class self, Class[] categoryClass)


mixin

public static void mixin(MetaClass self, Class categoryClass)


mixin

public static void mixin(MetaClass self, Class[] categoryClass)


mod

public static Number mod(Number left, Number right)


multiply

public static List multiply(Collection self, Number factor)


multiply

public static Number multiply(Character left, Number right)


multiply

public static Number multiply(Number left, Character right)


multiply

public static Number multiply(Character left, Character right)
Power of an integer to an integer certain exponent. If the exponent is positive, convert to a BigInteger and call BigInteger.pow(int) method to maintain precision. Called by the '**' operator.
Parameters:
self - an Integer
exponent - an Integer exponent
Returns:
a Number to the power of a the exponent


multiply

public static Number multiply(BigDecimal left, Double right)


multiply

public static Number multiply(BigDecimal left, BigInteger right)


multiply

@Deprecated
public static CharSequence multiply(CharSequence self, Number factor)


multiply

@Deprecated
public static String multiply(String self, Number factor)


newDataInputStream

@Deprecated
public static DataInputStream newDataInputStream(File file)


newDataOutputStream

@Deprecated
public static DataOutputStream newDataOutputStream(File file)


newInputStream

@Deprecated
public static BufferedInputStream newInputStream(File file)


newInputStream

@Deprecated
public static BufferedInputStream newInputStream(URL url)


newInputStream

@Deprecated
public static BufferedInputStream newInputStream(URL url, Map parameters)


newInstance

@SuppressWarnings}
public static Object newInstance(Class c)
Sets the metaclass for a given class.
Parameters:
self - the class whose metaclass we wish to set
metaClass - the new MetaClass
Since:
1.6.0


newInstance

@SuppressWarnings((ExpandoMetaClass) mc).define(closure);
public static Object newInstance(Class c, Object[] args)
Sets/updates the metaclass for a given class to a closure.
throws:
GroovyRuntimeException if the metaclass can't be set for this class
Parameters:
self - the class whose metaclass we wish to update
closure - the closure representing the new metaclass
Returns:
the new metaclass value
Since:
1.6.0


newObjectInputStream

@Deprecated
public static ObjectInputStream newObjectInputStream(File file)


newObjectInputStream

@Deprecated
public static ObjectInputStream newObjectInputStream(InputStream inputStream)


newObjectInputStream

@Deprecated
public static ObjectInputStream newObjectInputStream(InputStream inputStream, ClassLoader classLoader)


newObjectInputStream

@Deprecated
public static ObjectInputStream newObjectInputStream(File file, ClassLoader classLoader)


newObjectOutputStream

@Deprecated
public static ObjectOutputStream newObjectOutputStream(File file)


newObjectOutputStream

@Deprecated
public static ObjectOutputStream newObjectOutputStream(OutputStream outputStream)


newOutputStream

@Deprecated
public static BufferedOutputStream newOutputStream(File file)


newPrintWriter

@Deprecated
public static PrintWriter newPrintWriter(File file)


newPrintWriter

@Deprecated
public static PrintWriter newPrintWriter(File file, String charset)


newPrintWriter

@Deprecated
public static PrintWriter newPrintWriter(Writer writer)


newReader

@Deprecated
public static BufferedReader newReader(File file)


newReader

@Deprecated
public static BufferedReader newReader(File file, String charset)


newReader

@Deprecated
public static BufferedReader newReader(InputStream self)


newReader

@Deprecated
public static BufferedReader newReader(InputStream self, String charset)


newReader

@Deprecated
public static BufferedReader newReader(URL url)


newReader

@Deprecated}
public static BufferedReader newReader(URL url, Map parameters)


newReader

@Deprecated
public static BufferedReader newReader(URL url, String charset)


newReader

@Deprecated
public static BufferedReader newReader(URL url, Map parameters, String charset)


newWriter

@Deprecated
public static BufferedWriter newWriter(File file)


newWriter

@Deprecated
public static BufferedWriter newWriter(File file, boolean append)


newWriter

@Deprecated
public static BufferedWriter newWriter(File file, String charset, boolean append)


newWriter

@Deprecated
public static BufferedWriter newWriter(File file, String charset)


next

public static Character next(Character self)
Compare a Number and a Character. The ordinal value of the Character is used in the comparison (the ordinal value is the unicode value which for simple character sets is the ASCII value).
Parameters:
left - a Number
right - a Character
Returns:
the result of the comparison
Since:
1.0


next

public static Number next(Number self)


next

@Deprecated
public static CharSequence next(CharSequence self)


next

@Deprecated
public static String next(String self)


normalize

@Deprecated
public static CharSequence normalize(CharSequence self)


normalize

@Deprecated
public static String normalize(String self)


numberAwareCompareTo

public static int numberAwareCompareTo(Comparable self, Comparable other)
Provides a method that compares two comparables using Groovy's default number aware comparator.
Parameters:
self - a Comparable
other - another Comparable
Returns:
a -ve number, 0 or a +ve number according to Groovy's compareTo contract
Since:
1.6.0


or

public static Number or(Number left, Number right)


or

public static BitSet or(BitSet left, BitSet right)


or

public static Boolean or(Boolean left, Boolean right)
Iterates over the elements of an iterable collection of items and returns the index of the last item that matches the condition specified in the closure.
Parameters:
self - the iteration object over which to iterate
closure - the filter to perform a match on the collection
Returns:
an integer that is the index of the last matched object or -1 if no match was found
Since:
1.5.2


padLeft

@Deprecated
public static CharSequence padLeft(CharSequence self, Number numberOfChars)


padLeft

@Deprecated
public static CharSequence padLeft(CharSequence self, Number numberOfChars, CharSequence padding)


padLeft

@Deprecated
public static String padLeft(String self, Number numberOfChars)


padLeft

@Deprecated
public static String padLeft(String self, Number numberOfChars, String padding)


padRight

@Deprecated
public static CharSequence padRight(CharSequence self, Number numberOfChars)


padRight

@Deprecated
public static CharSequence padRight(CharSequence self, Number numberOfChars, CharSequence padding)


padRight

@Deprecated
public static String padRight(String self, Number numberOfChars)


padRight

@Deprecated
public static String padRight(String self, Number numberOfChars, String padding)


permutations

public static Set permutations(List self)


plus

public static Map plus(Map left, Map right)
A helper method to allow maps to work with subscript operators
Parameters:
self - a Map
key - an Object as a key for the map
value - the value to put into the map
Returns:
the value corresponding to the given key
Since:
1.0


plus

public static Map plus(Map self, Collection entries)


plus

@SuppressWarnings* @param right a Collection to be appended
public static Object[] plus(Object[] left, Object[] right)


plus

@SuppressWarnings* assert result.class.array
public static Object[] plus(Object[] left, Object right)


plus

@SuppressWarnings* 
assert [1,2,3,4] == [1,2] + [3,4]
public static Object[] plus(Object[] left, Collection right)


plus

@SuppressWarnings* @since 1.8.7
public static Object[] plus(Object[] left, Iterable right)


plus

public static Collection plus(Collection left, Collection right)


plus

public static Collection plus(Collection left, Iterable right)


plus

public static List plus(List self, int index, Object[] items)
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. Shifts the element currently at that index (if any) and any subsequent elements to the right (increasing their indices). The new elements will appear in the resulting List in the order that they occur in the original lists. The behavior of this operation is undefined if the original lists are modified while the operation is in progress. The original lists remain unchanged.
 def items = [1, 2, 3]
 def newItems = items.plus(2, 'a'..'c')
 assert newItems == [1, 2, 'a', 'b', 'c', 3]
 assert items == [1, 2, 3]
 
See also addAll for similar functionality with modify semantics, i.e. which performs the changes on the original list itself.
Parameters:
self - an original List
additions - a List containing elements to be merged with elements from the original List
index - index at which to insert the first element from the given additions List
Returns:
the new list
Since:
1.8.1


plus

public static List plus(List self, int index, List additions)
Creates a new List by inserting all of the elements in the given Iterable to the elements from this List at the specified index.
Parameters:
self - an original list
additions - an Iterable containing elements to be merged with the elements from the original List
index - index at which to insert the first element from the given additions Iterable
Returns:
the new list
See Also:
plus(List, int, List)
Since:
1.8.7


plus

public static List plus(List self, int index, Iterable additions)


plus

public static Collection plus(Collection left, Object right)


plus

public static Number plus(Character left, Number right)


plus

public static Number plus(Number left, Character right)


plus

public static Number plus(Character left, Character right)


plus

@Deprecated
public static CharSequence plus(CharSequence left, Object value)


plus

@Deprecated
public static String plus(Number value, String right)


plus

@Deprecated
public static String plus(String left, Object value)


plus

@Deprecated
public static String plus(StringBuffer left, String value)


pop

public static Object pop(List self)


power

public static Number power(Number self, Number exponent)


power

public static Number power(BigDecimal self, Integer exponent)
Divide one Character by another. The ordinal values of the Characters are used in the division (the ordinal value is the unicode value which for simple character sets is the ASCII value).
Parameters:
left - a Character
right - another Character
Returns:
the Number corresponding to the division of left by right
Since:
1.0


power

public static Number power(BigInteger self, Integer exponent)
Integer Divide a Character by a Number. The ordinal value of the Character is used in the division (the ordinal value is the unicode value which for simple character sets is the ASCII value).
Parameters:
left - a Character
right - a Number
Returns:
a Number (an Integer) resulting from the integer division operation
Since:
1.0


power

public static Number power(Integer self, Integer exponent)
Integer Divide a Number by a Character. The ordinal value of the Character is used in the division (the ordinal value is the unicode value which for simple character sets is the ASCII value).
Parameters:
left - a Number
right - a Character
Returns:
a Number (an Integer) resulting from the integer division operation
Since:
1.0


power

public static Number power(Long self, Integer exponent)
Integer Divide two Numbers.
Parameters:
left - a Number
right - another Number
Returns:
a Number (an Integer) resulting from the integer division operation
Since:
1.0


previous

public static Character previous(Character self)


previous

public static Number previous(Number self)
todo:
maybe a double dispatch thing to handle new large numbers?


previous

@Deprecated
public static CharSequence previous(CharSequence self)


previous

@Deprecated
public static String previous(String self)


primitiveArrayGet

protected static Object primitiveArrayGet(Object self, int idx)


primitiveArrayGet

protected static List primitiveArrayGet(Object self, Range range)


primitiveArrayGet

protected static List primitiveArrayGet(Object self, Collection indices)
Checks whether the array contains the given value.
Parameters:
self - the array within which we count the number of occurrences
value - the value being searched for
Returns:
the number of occurrences
Since:
1.8.6


primitiveArrayPut

protected static Object primitiveArrayPut(Object self, int idx, Object newValue)
Checks whether the array contains the given value.
Parameters:
self - the array we are searching
value - the value being searched for
Returns:
true if the array contains the value
Since:
1.8.6


print

public 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.
Parameters:
self - any Object
value - the value to print
Since:
1.0


print

public static void print(PrintWriter self, Object value)
Print a value formatted Groovy style to the print writer.
Parameters:
self - a PrintWriter
value - the value to print
Since:
1.0


print

public static void print(PrintStream self, Object value)


print

public static void print(Closure self, Object value)


print

public static void print(Object self, PrintWriter out)


printf

public static void printf(Object self, String format, Object[] values)


printf

public static void printf(Object self, String format, Object arg)


println

public static void println(Object self)


println

public static void println(Closure self)
Print a linebreak to the standard output stream. This method delegates to the owner to execute the method.
Parameters:
self - a closure
Since:
1.0


println

public 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.
Parameters:
self - any Object
value - the value to print
Since:
1.0


println

public static void println(PrintWriter self, Object value)
Print a value formatted Groovy style (followed by a newline) to the print writer.
Parameters:
self - a PrintWriter
value - the value to print
Since:
1.0


println

public static void println(PrintStream self, Object value)


println

public static void println(Closure self, Object value)


println

public static void println(Object self, PrintWriter out)


push

public static boolean push(List self, Object value)


putAll

public static Map putAll(Map self, Collection entries)


putAt

public static void putAt(Object self, String property, Object newValue)


putAt

public static void putAt(List self, int idx, Object value)
A helper method to allow lists to work with subscript operators.
def list = ["a", true]
 list[1..<1] = 5
 assert list == ["a", 5, true]
Parameters:
self - a List
range - the (in this case empty) subset of the list to set
value - the values to put at the given sublist or a Collection of values
Since:
1.0


putAt

public static void putAt(List self, EmptyRange range, Object value)
A helper method to allow lists to work with subscript operators.
def list = ["a", true]
 list[1..<1] = [4, 3, 2]
 assert list == ["a", 4, 3, 2, true]
Parameters:
self - a List
range - the (in this case empty) subset of the list to set
value - the Collection of values
See Also:
putAt(java.util.List, groovy.lang.EmptyRange, java.lang.Object)
Since:
1.0


putAt

public static void putAt(List self, EmptyRange range, Collection value)


putAt

public static void putAt(List self, IntRange range, Collection col)
List subscript assignment operator when given a range as the index. Example:
def myList = [4, 3, 5, 1, 2, 8, 10]
 myList[3..5] = "b"
 assert myList == [4, 3, 5, "b", 10]
Items in the given range are replaced with the operand. The value operand is always treated as a single value.
Parameters:
self - a List
range - the subset of the list to set
value - the value to put at the given sublist
Since:
1.0


putAt

public static void putAt(List self, IntRange range, Object value)


putAt

public static void putAt(List self, List splice, List values)


putAt

public static void putAt(List self, List splice, Object value)


putAt

public static Object putAt(Map self, Object key, Object value)


putAt

public static void putAt(BitSet self, IntRange range, boolean value)
Support assigning a range of values with a single assignment statement.
Parameters:
self - a BitSet
range - the range of values to set
value - value
See Also:
BitSet
Range
Since:
1.5.0


putAt

public static void putAt(BitSet self, int index, boolean value)
Converts this array to a List of the same size, with each element added to the list.
Parameters:
array - a byte array
Returns:
a list containing the contents of this array.
Since:
1.0


putAt

@Deprecated
public static void putAt(StringBuffer self, EmptyRange range, Object value)


putAt

@Deprecated
public static void putAt(StringBuffer self, IntRange range, Object value)


readBytes

@Deprecated
public static byte[] readBytes(File file)


readLine

@Deprecated
public static String readLine(Reader self)


readLines

@Deprecated
public static List readLines(CharSequence self)


readLines

@Deprecated
public static List readLines(String self)


readLines

@Deprecated
public static List readLines(File file)


readLines

@Deprecated
public static List readLines(File file, String charset)


readLines

@Deprecated
public static List readLines(InputStream stream)


readLines

@Deprecated
public static List readLines(InputStream stream, String charset)


readLines

@Deprecated
public static List readLines(URL self)


readLines

@Deprecated
public static List readLines(URL self, String charset)


readLines

@Deprecated
public static List readLines(Reader reader)


removeAll

public static boolean removeAll(Collection self, Object[] items)


removeAll

public static boolean removeAll(Collection self, Closure condition)


renameTo

@Deprecated
public static boolean renameTo(File self, String newPathName)


replaceAll

@Deprecated
public static CharSequence replaceAll(CharSequence self, CharSequence regex, CharSequence replacement)


replaceAll

@Deprecated
public static CharSequence replaceAll(CharSequence self, CharSequence regex, Closure closure)


replaceAll

@Deprecated
public static CharSequence replaceAll(CharSequence self, Pattern pattern, CharSequence replacement)


replaceAll

@Deprecated
public static String replaceAll(CharSequence self, Pattern pattern, Closure closure)


replaceAll

@Deprecated
public static String replaceAll(String self, Pattern pattern, Closure closure)


replaceAll

@Deprecated
public static String replaceAll(String self, Pattern pattern, String replacement)


replaceAll

@Deprecated
public static String replaceAll(String self, String regex, Closure closure)


replaceFirst

@Deprecated
public static String replaceFirst(CharSequence self, CharSequence regex, CharSequence replacement)


replaceFirst

@Deprecated
public static String replaceFirst(CharSequence self, CharSequence regex, Closure closure)


replaceFirst

@Deprecated
public static CharSequence replaceFirst(CharSequence self, Pattern pattern, CharSequence replacement)


replaceFirst

@Deprecated
public static String replaceFirst(CharSequence self, Pattern pattern, Closure closure)


replaceFirst

@Deprecated
public static String replaceFirst(String self, Pattern pattern, Closure closure)


replaceFirst

@Deprecated
public static String replaceFirst(String self, Pattern pattern, String replacement)


replaceFirst

@Deprecated
public static String replaceFirst(String self, String regex, Closure closure)


respondsTo

public static List respondsTo(Object self, String name, Object[] argTypes)


respondsTo

public static List respondsTo(Object self, String name)


retainAll

public static boolean retainAll(Collection self, Object[] items)


retainAll

public static boolean retainAll(Collection self, Closure condition)


reverse

public static List reverse(List self)
Reverses the elements in a list. If mutate is true, the original list is modified in place and returned. Otherwise, a new list containing the reversed items is produced.
 def list = ["a", 4, false]
 assert list.reverse(false) == [false, 4, "a"]
 assert list == ["a", 4, false]
 assert list.reverse(true) == [false, 4, "a"]
 assert list == [false, 4, "a"]
 
Parameters:
self - a List
mutate - true if the list itself should be reversed in place and returned, false if a new list should be created
Returns:
a reversed List
Since:
1.8.1


reverse

public static List reverse(List self, boolean mutate)
Creates a new array containing items which are the same as this array but in reverse order.
Parameters:
self - an array
Returns:
an array containing the reversed items
See Also:
reverse(Object[], boolean)
Since:
1.5.5


reverse

@SuppressWarnings* @since 1.5.5
public static Object[] reverse(Object[] self)


reverse

@SuppressWarnings* @param left  the left Array
public static Object[] reverse(Object[] self, boolean mutate)


reverse

public static Iterator reverse(Iterator self)


reverse

@Deprecated
public static CharSequence reverse(CharSequence self)


reverse

@Deprecated
public static String reverse(String self)


reverseEach

public static Map reverseEach(Map self, Closure closure)


reverseEach

public static List reverseEach(List self, Closure closure)


reverseEach

public static Object[] reverseEach(Object[] self, Closure closure)


rightShift

public static Number rightShift(Number self, Number operand)
Support the subscript operator with a range for a char array
Parameters:
array - a char array
range - a range indicating the indices for the items to retrieve
Returns:
list of the retrieved chars
Since:
1.5.0


rightShiftUnsigned

public static Number rightShiftUnsigned(Number self, Number operand)
Support the subscript operator with a range for a short array
Parameters:
array - a short array
range - a range indicating the indices for the items to retrieve
Returns:
list of the retrieved shorts
Since:
1.0


round

public static int round(Float number)


round

public static float round(Float number, int precision)


round

public static long round(Double number)


round

public static double round(Double number, int precision)
Converts the character to uppercase. Synonym for 'Character.toUpperCase(this)'.
Parameters:
self - a Character to convert
Returns:
the uppercase equivalent of the character, if any; otherwise, the character itself.
See Also:
Character.isUpperCase
String.toUpperCase
Since:
1.5.7


runAfter

public static TimerTask runAfter(Timer timer, int delay, Closure closure)
Iterates over the elements of an iterable collection of items and returns the index values of the items that match the condition specified in the closure.
Parameters:
self - the iteration object over which to iterate
closure - the filter to perform a match on the collection
Returns:
a list of numbers corresponding to the index values of all matched objects
Since:
1.5.2


setBytes

@Deprecated
public static void setBytes(File file, byte[] bytes)


setBytes

@Deprecated
public static void setBytes(OutputStream os, byte[] bytes)


setIndex

@Deprecated
public static void setIndex(Matcher matcher, int idx)


setMetaClass

public static void setMetaClass(Class self, MetaClass metaClass)


setMetaClass

public static void setMetaClass(Object self, MetaClass metaClass)


setMetaClass

public static void setMetaClass(GroovyObject self, MetaClass metaClass)


setText

@Deprecated
public static void setText(File file, String text)


setText

@Deprecated
public static void setText(File file, String text, String charset)


size

public static int size(Iterator self)


size

public static int size(Object[] self)


size

public static int size(boolean[] array)


size

public static int size(byte[] array)


size

public static int size(char[] array)
Converts this array to a List of the same size, with each element added to the list.
Parameters:
array - a short array
Returns:
a list containing the contents of this array.
Since:
1.0


size

public static int size(short[] array)
Converts this array to a List of the same size, with each element added to the list.
Parameters:
array - an int array
Returns:
a list containing the contents of this array.
Since:
1.0


size

public static int size(int[] array)


size

public static int size(long[] array)


size

public static int size(float[] array)


size

public static int size(double[] array)


size

@Deprecated
public static int size(CharSequence text)


size

@Deprecated
public static long size(Matcher self)


size

@Deprecated
public static int size(String text)


size

@Deprecated
public static int size(StringBuffer buffer)


size

@Deprecated
public static long size(File self)


sort

public static List sort(Collection self)


sort

public static List sort(Collection self, boolean mutate)
Sorts the elements from the given map into a new ordered map using the closure as a comparator to determine the ordering. The original map is unchanged.
def map = [a:5, b:3, c:6, d:4].sort { a, b -> a.value <=> b.value }
 assert map == [b:3, d:4, a:5, c:6]
Parameters:
self - the original unsorted map
closure - a Closure used as a comparator
Returns:
the sorted map
Since:
1.6.0


sort

public static Map sort(Map self, Closure closure)


sort

public static Map sort(Map self, Comparator comparator)


sort

public static Map sort(Map self)


sort

public static Object[] sort(Object[] self)


sort

public static Object[] sort(Object[] self, boolean mutate)
Sorts the given iterator items into a sorted iterator. The items are assumed to be comparable. The original iterator will become exhausted of elements after completing this method call. A new iterator is produced that traverses the items in sorted order.
Parameters:
self - the Iterator to be sorted
Returns:
the sorted items as an Iterator
Since:
1.5.5


sort

public static Iterator sort(Iterator self)


sort

public static Iterator sort(Iterator self, Comparator comparator)


sort

public static List sort(Collection self, Comparator comparator)


sort

public static List sort(Collection self, boolean mutate, Comparator comparator)
Sorts the given array into sorted order using the given comparator.
Parameters:
self - the array to be sorted
comparator - a Comparator used for the comparison
Returns:
the sorted array
Since:
1.5.5


sort

public static Object[] sort(Object[] self, Comparator comparator)


sort

public static Object[] sort(Object[] self, boolean mutate, Comparator comparator)
Sorts the given iterator items into a sorted iterator using the Closure to determine the correct ordering. The original iterator will be fully processed after the method call. If the closure has two parameters it is used like a traditional Comparator. I.e. it should compare its two parameters for order, returning a negative integer, zero, or a positive integer when the first parameter is less than, equal to, or greater than the second respectively. Otherwise, the Closure is assumed to take a single parameter and return a Comparable (typically an Integer) which is then used for further comparison.
Parameters:
self - the Iterator to be sorted
closure - a Closure used to determine the correct ordering
Returns:
the sorted items as an Iterator
Since:
1.5.5


sort

public static Iterator sort(Iterator self, Closure closure)


sort

@SuppressWarnings*/
public static Object[] sort(Object[] self, Closure closure)


sort

@SuppressWarnings* @since 1.0
public static Object[] sort(Object[] self, boolean mutate, Closure closure)


sort

public static List sort(Collection self, Closure closure)


sort

public static List sort(Collection self, boolean mutate, Closure closure)
Avoids doing unnecessary work when sorting an already sorted set (i.e. an identity function for an already sorted set).
Parameters:
self - an already sorted set
Returns:
the set
Since:
1.0


sort

public static SortedSet sort(SortedSet self)
Removes the last item from the List. Using add() and pop() is similar to push and pop on a Stack.
def list = ["a", false, 2]
 assert list.pop() == 2
 assert list == ["a", false]
throws:
NoSuchElementException if the list is empty and you try to pop() it.
Parameters:
self - a List
Returns:
the item removed from the List
Since:
1.0


sort

public static SortedMap sort(SortedMap self)


split

public static Collection split(Object self, Closure closure)


split

public static Collection split(Collection self, Closure closure)


split

@Deprecated
public static CharSequence[] split(CharSequence self)


split

@Deprecated
public static String[] split(GString self)


split

@Deprecated
public static String[] split(String self)


splitEachLine

@Deprecated
public static Object splitEachLine(CharSequence self, CharSequence regex, Closure closure)


splitEachLine

@Deprecated
public static Object splitEachLine(CharSequence self, Pattern pattern, Closure closure)


splitEachLine

@Deprecated
public static Object splitEachLine(String self, Pattern pattern, Closure closure)


splitEachLine

@Deprecated
public static Object splitEachLine(String self, String regex, Closure closure)


splitEachLine

@Deprecated
public static Object splitEachLine(File self, String regex, Closure closure)


splitEachLine

@Deprecated
public static Object splitEachLine(File self, Pattern pattern, Closure closure)


splitEachLine

@Deprecated
public static Object splitEachLine(File self, String regex, String charset, Closure closure)


splitEachLine

@Deprecated
public static Object splitEachLine(File self, Pattern pattern, String charset, Closure closure)


splitEachLine

@Deprecated
public static Object splitEachLine(URL self, String regex, Closure closure)


splitEachLine

@Deprecated
public static Object splitEachLine(URL self, Pattern pattern, Closure closure)


splitEachLine

@Deprecated
public static Object splitEachLine(URL self, String regex, String charset, Closure closure)


splitEachLine

@Deprecated
public static Object splitEachLine(URL self, Pattern pattern, String charset, Closure closure)


splitEachLine

@Deprecated
public static Object splitEachLine(Reader self, String regex, Closure closure)


splitEachLine

@Deprecated
public static Object splitEachLine(Reader self, Pattern pattern, Closure closure)


splitEachLine

@Deprecated
public static Object splitEachLine(InputStream stream, String regex, String charset, Closure closure)


splitEachLine

@Deprecated
public static Object splitEachLine(InputStream stream, Pattern pattern, String charset, Closure closure)


splitEachLine

@Deprecated
public static Object splitEachLine(InputStream stream, String regex, Closure closure)


splitEachLine

@Deprecated
public static Object splitEachLine(InputStream stream, Pattern pattern, Closure closure)


spread

public static SpreadMap spread(Map self)


sprintf

public static String sprintf(Object self, String format, Object[] values)


sprintf

public static String sprintf(Object self, String format, Object arg)


step

public static void step(Number self, Number to, Number stepNumber, Closure closure)
Get the absolute value
Parameters:
number - a Float
Returns:
the absolute value of that Float
Since:
1.0


stripIndent

@Deprecated
public static CharSequence stripIndent(CharSequence self)


stripIndent

@Deprecated}
public static CharSequence stripIndent(CharSequence self, int numChars)


stripIndent

@Deprecated}
public static String stripIndent(String self)


stripIndent

@Deprecated}
public static String stripIndent(String self, int numChars)


stripMargin

@Deprecated}
public static CharSequence stripMargin(CharSequence self)


stripMargin

@Deprecated}
public static CharSequence stripMargin(CharSequence self, char marginChar)


stripMargin

@Deprecated}
public static String stripMargin(CharSequence self, CharSequence marginChar)


stripMargin

@Deprecated}
public static String stripMargin(String self)


stripMargin

@Deprecated}
public static String stripMargin(String self, char marginChar)


stripMargin

@Deprecated}
public static String stripMargin(String self, String marginChar)


subMap

public static Map subMap(Map map, Collection keys)
Creates a sub-Map containing the given keys. This method is similar to List.subList() but uses keys rather than index ranges. The original map is unaltered.
 def orig = [1:10, 2:20, 3:30, 4:40]
 assert orig.subMap([1, 3] as int[]) == [1:10, 3:30]
 assert orig.subMap([2, 4] as Integer[]) == [2:20, 4:40]
 assert orig.size() == 4
 
Parameters:
map - a Map
keys - an array of keys
Returns:
a new Map containing the given keys
Since:
2.1.0


subMap

public static Map subMap(Map map, Object[] keys)
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.
def map=[:]
 map.get("a", []) << 5
 assert map == [a:[5]]
Parameters:
map - a Map
key - the key to lookup the value of
defaultValue - the value to return and add to the map for this key if there is no entry for the given key
Returns:
the value of the given key or the default value, added to the map if the key did not exist
Since:
1.0


subsequences

public static Set subsequences(List self)
Finds all permutations of a collection.

Example usage:

def result = [1, 2, 3].permutations()
 assert result == [[3, 2, 1], [3, 1, 2], [1, 3, 2], [2, 3, 1], [2, 1, 3], [1, 2, 3]] as Set
Parameters:
self - the Collection of items
Returns:
the permutations from the list
Since:
1.7.0


sum

public static Object sum(Collection self)
Sums the items in an array. This is equivalent to invoking the "plus" method on all items in the array.
Parameters:
self - The array of values to add together
Returns:
The sum of all of the items
See Also:
sum(java.util.Collection)
Since:
1.7.1


sum

public static Object sum(Object[] self)


sum

public static Object sum(Iterator self)


sum

public static Object sum(Collection self, Object initialValue)


sum

public static Object sum(Object[] self, Object initialValue)


sum

public static Object sum(Iterator self, Object initialValue)


sum

public static Object sum(Collection self, Closure closure)
Sums the result of apply a closure to each item of an array. array.sum(closure) is equivalent to: array.collect(closure).sum().
Parameters:
self - An array
closure - a single parameter closure that returns a numeric value.
Returns:
The sum of the values returned by applying the closure to each item of the array.
Since:
1.7.1


sum

public static Object sum(Object[] self, Closure closure)


sum

public static Object sum(Iterator self, Closure closure)


sum

public static Object sum(Collection self, Object initialValue, Closure closure)


sum

public static Object sum(Object[] self, Object initialValue, Closure closure)


sum

public static Object sum(Iterator self, Object initialValue, Closure closure)


tail

public static List tail(List self)


tail

public static Object[] tail(Object[] self)
Returns the first num elements from the head of this list.
 def strings = [ 'a', 'b', 'c' ]
 assert strings.take( 0 ) == []
 assert strings.take( 2 ) == [ 'a', 'b' ]
 assert strings.take( 5 ) == [ 'a', 'b', 'c' ]
 
Similar to take(Iterable, int) except that it attempts to preserve the type of the original list.
Parameters:
self - the original list
num - the number of elements to take from this list
Returns:
a list consisting of the first num elements of this list, or else the whole list if it has less then num elements.
Since:
1.8.1


take

public static List take(List self, int num)
Returns the first num elements from the head of this array.
 String[] strings = [ 'a', 'b', 'c' ]
 assert strings.take( 0 ) == [] as String[]
 assert strings.take( 2 ) == [ 'a', 'b' ] as String[]
 assert strings.take( 5 ) == [ 'a', 'b', 'c' ] as String[]
 
Parameters:
self - the original array
num - the number of elements to take from this array
Returns:
an array consisting of the first num elements of this array, or else the whole array if it has less then num elements.
Since:
1.8.1


take

public static Object[] take(Object[] self, int num)


take

public static List take(Iterable self, int num)
Returns a new map containing the first num elements from the head of this map. If the map instance does not have ordered keys, then this function could return a random num entries. Groovy by default uses LinkedHashMap, so this shouldn't be an issue in the main.
 def strings = [ 'a':10, 'b':20, 'c':30 ]
 assert strings.take( 0 ) == [:]
 assert strings.take( 2 ) == [ 'a':10, 'b':20 ]
 assert strings.take( 5 ) == [ 'a':10, 'b':20, 'c':30 ]
 
Parameters:
self - the original map
num - the number of elements to take from this map
Returns:
a new map consisting of the first num elements of this map, or else the whole map if it has less then num elements.
Since:
1.8.1


take

public static Map take(Map self, int num)


take

@SuppressWarningspublic static CharSequence take(CharSequence self, int num) {
public static Iterator take(Iterator self, int num)


take

@Deprecatedret.addAll(self);
public static CharSequence take(CharSequence self, int num)


takeWhile

public static List takeWhile(List self, Closure condition)


takeWhile

public static List takeWhile(Iterable 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.
 def shopping = [milk:1, bread:2, chocolate:3]
 assert shopping.takeWhile{ it.key.size() < 6 } == [milk:1, bread:2]
 assert shopping.takeWhile{ it.value % 2 } == [milk:1]
 assert shopping.takeWhile{ k, v -> k.size() + v <= 7 } == [milk:1, bread:2]
 
If the map instance does not have ordered keys, then this function could appear to take random entries. Groovy by default uses LinkedHashMap, so this shouldn't be an issue in the main.
Parameters:
self - a Map
condition - a 1 (or 2) arg Closure that must evaluate to true for the entry (or key and value) to continue taking elements
Returns:
a prefix of the given Map where each entry (or key/value pair) passed to the given closure evaluates to true
Since:
1.8.7


takeWhile

public static Map takeWhile(Map self, Closure condition)
Returns the longest prefix of this array where each element passed to the given closure evaluates to true.
 def nums = [ 1, 3, 2 ] as Integer[]
 assert nums.takeWhile{ it < 1 } == [] as Integer[]
 assert nums.takeWhile{ it < 3 } == [ 1 ] as Integer[]
 assert nums.takeWhile{ it < 4 } == [ 1, 3, 2 ] as Integer[]
 
Parameters:
self - the original array
condition - the closure that must evaluate to true to continue taking elements
Returns:
a prefix of the given array where each element passed to the given closure evaluates to true
Since:
1.8.7


takeWhile

public static Object[] takeWhile(Object[] self, Closure condition)


takeWhile

public static Iterator takeWhile(Iterator self, Closure condition)


times

public static void times(Number self, Closure closure)


toArrayString

public static String toArrayString(Object[] self)


toBigDecimal

public static BigDecimal toBigDecimal(Number self)
Logical implication of two boolean operators
Parameters:
left - left operator
right - right operator
Returns:
result of logical implication
Since:
1.8.3


toBigDecimal

@Deprecated}
public static BigDecimal toBigDecimal(CharSequence self)


toBigDecimal

@Deprecated}
public static BigDecimal toBigDecimal(String self)


toBigInteger

public static BigInteger toBigInteger(Number self)
Iterates over the elements of an iterable collection of items and returns the index of the first item that matches the condition specified in the closure.
Parameters:
self - the iteration object over which to iterate
closure - the filter to perform a match on the collection
Returns:
an integer that is the index of the first matched object or -1 if no match was found
Since:
1.0


toBigInteger

@Deprecated}
public static BigInteger toBigInteger(CharSequence self)


toBigInteger

@Deprecated}
public static BigInteger toBigInteger(String self)


toBoolean

public static Boolean toBoolean(Boolean self)


toBoolean

@Deprecated}
public static Boolean toBoolean(String self)


toCharacter

@Deprecated}
public static Character toCharacter(String self)


toDouble

public static Double toDouble(Number self)
Logical disjunction of two boolean operators
Parameters:
left - left operator
right - right operator
Returns:
result of logical disjunction
Since:
1.0


toDouble

@Deprecated}
public static Double toDouble(CharSequence self)


toDouble

@Deprecated}
public static Double toDouble(String self)


toFloat

public static Float toFloat(Number self)
Logical conjunction of two boolean operators.
Parameters:
left - left operator
right - right operator
Returns:
result of logical conjunction
Since:
1.0


toFloat

@Deprecated}
public static Float toFloat(CharSequence self)


toFloat

@Deprecated}
public static Float toFloat(String self)


toInteger

public static Integer toInteger(Number self)


toInteger

@Deprecated}
public static Integer toInteger(CharSequence self)


toInteger

@Deprecated}
public static Integer toInteger(String self)


toList

public static List toList(Collection self)
Convert an iterator to a List. The iterator will become exhausted of elements after making this conversion.
Parameters:
self - an iterator
Returns:
a List
Since:
1.5.0


toList

public static List toList(Iterator self)


toList

public static List toList(Iterable self)
Convert an enumeration to a List.
Parameters:
self - an enumeration
Returns:
a List
Since:
1.5.0


toList

public static List toList(Enumeration self)


toList

public static List toList(Object[] array)


toList

@SuppressWarnings
public static List toList(byte[] array)
Converts this array to a Set, with each unique element added to the set.
Parameters:
array - a byte array
Returns:
a set containing the unique contents of this array.
Since:
1.8.0


toList

@SuppressWarnings
public static List toList(boolean[] array)
Converts this array to a Set, with each unique element added to the set.
Parameters:
array - a boolean array
Returns:
a set containing the unique contents of this array.
Since:
1.8.0


toList

@SuppressWarnings
public static List toList(char[] array)
Converts this array to a Set, with each unique element added to the set.
Parameters:
array - a char array
Returns:
a set containing the unique contents of this array.
Since:
1.8.0


toList

@SuppressWarnings
public static List toList(short[] array)
Converts this array to a Set, with each unique element added to the set.
Parameters:
array - a short array
Returns:
a set containing the unique contents of this array.
Since:
1.8.0


toList

@SuppressWarnings
public static List toList(int[] array)
Converts this array to a Set, with each unique element added to the set.
Parameters:
array - an int array
Returns:
a set containing the unique contents of this array.
Since:
1.8.0


toList

@SuppressWarnings
public static List toList(long[] array)
Converts this array to a Set, with each unique element added to the set.
Parameters:
array - a long array
Returns:
a set containing the unique contents of this array.
Since:
1.8.0


toList

@SuppressWarnings
public static List toList(float[] array)
Converts this array to a Set, with each unique element added to the set.
Parameters:
array - a float array
Returns:
a set containing the unique contents of this array.
Since:
1.8.0


toList

@SuppressWarnings
public static List toList(double[] array)
Converts this array to a Set, with each unique element added to the set.
Parameters:
array - a double array
Returns:
a set containing the unique contents of this array.
Since:
1.8.0


toList

@Deprecated
public static List toList(CharSequence self)


toList

@Deprecated
public static List toList(String self)


toListString

public static String toListString(Collection self)


toListString

public static String toListString(Collection self, int maxSize)


toLong

public static Long toLong(Number self)


toLong

@Deprecated
public static Long toLong(CharSequence self)


toLong

@Deprecated
public static Long toLong(String self)


toLowerCase

public static char toLowerCase(Character self)


toMapString

public static String toMapString(Map self)
Increment a Character by one.
Parameters:
self - a Character
Returns:
an incremented Character
Since:
1.5.7


toMapString

public static String toMapString(Map self, int maxSize)


toSet

@SuppressWarnings* @return a Set
public static Set toSet(byte[] array)


toSet

@SuppressWarnings* @param self an iterator
public static Set toSet(boolean[] array)


toSet

@SuppressWarnings* Convert an enumeration to a Set.
public static Set toSet(char[] array)


toSet

@SuppressWarnings
public static Set toSet(short[] array)


toSet

@SuppressWarnings/**
public static Set toSet(int[] array)
Implements the getAt(int) method for primitive type arrays.
Parameters:
self - an array object
idx - the index of interest
Returns:
the returned value from the array
Since:
1.5.0


toSet

@SuppressWarnings}
public static Set toSet(long[] array)
Implements the getAt(Range) method for primitive type arrays.
Parameters:
self - an array object
range - the range of indices of interest
Returns:
the returned values from the array corresponding to the range
Since:
1.5.0


toSet

@SuppressWarnings*/
public static Set toSet(float[] array)


toSet

@SuppressWarningsreturn answer;
public static Set toSet(double[] array)


toSet

public static Set toSet(Collection self)
Implements the setAt(int idx) method for primitive type arrays.
Parameters:
self - an object
idx - the index of interest
newValue - the new value to be put into the index of interest
Returns:
the added value
Since:
1.5.0


toSet

public static Set toSet(Iterator self)


toSet

public static Set toSet(Enumeration self)


toSet

@Deprecated
public static Set toSet(CharSequence self)


toSet

@Deprecated
public static Set toSet(String self)


toShort

@Deprecated
public static Short toShort(CharSequence self)


toShort

@Deprecated
public static Short toShort(String self)


toSpreadMap

public static SpreadMap toSpreadMap(Map self)
Creates a spreadable map from this array.

Parameters:
self - an object array
Returns:
a newly created SpreadMap
See Also:
SpreadMap.SpreadMap
toSpreadMap(java.util.Map)
Since:
1.0


toSpreadMap

public static SpreadMap toSpreadMap(Object[] self)


toSpreadMap

public static SpreadMap toSpreadMap(List self)


toString

public static String toString(boolean[] self)


toString

public static String toString(byte[] self)


toString

public static String toString(char[] self)


toString

public static String toString(short[] self)
Returns the string representation of the given list. The string displays the contents of the list, similar to a list literal, i.e. [1, 2, a].
Parameters:
self - a Collection
Returns:
the string representation
Since:
1.0


toString

public static String toString(int[] self)


toString

public static String toString(long[] self)


toString

public static String toString(float[] self)


toString

public static String toString(double[] self)


toString

public static String toString(AbstractMap self)


toString

public static String toString(AbstractCollection self)


toString

public static String toString(Object[] self)


toString

public static String toString(Object value)


toURI

@Deprecated
public static URI toURI(CharSequence self)


toURI

@Deprecated
public static URI toURI(String self)


toURL

@Deprecated
public static URL toURL(CharSequence self)


toURL

@Deprecated
public static URL toURL(String self)


toUpperCase

public static char toUpperCase(Character self)


tokenize

@Deprecated}
public static List tokenize(CharSequence self)


tokenize

@Deprecated}
public static List tokenize(CharSequence self, Character token)


tokenize

@Deprecated}
public static List tokenize(CharSequence self, CharSequence token)


tokenize

@Deprecated}
@SuppressWarnings
public static List tokenize(String self)


tokenize

@Deprecated
public static List tokenize(String self, Character token)


tokenize

@Deprecated
@SuppressWarnings@Deprecated
public static List tokenize(String self, String token)


tr

@Deprecated
public static CharSequence tr(CharSequence self, CharSequence sourceSet, CharSequence replacementSet)


tr

@Deprecated
public static String tr(String self, String sourceSet, String replacementSet)


transformChar

@Deprecated
public static void transformChar(Reader self, Writer writer, Closure closure)


transformLine

@Deprecated
public static void transformLine(Reader reader, Writer writer, Closure closure)


transpose

public static List transpose(List self)


traverse

@Deprecated
public static void traverse(File self, Map options, Closure closure)


traverse

@Deprecatedpublic static  T withDataOutputStream(File file, Closure closure) throws IOException {
public static void traverse(File self, Closure closure)


traverse

@Deprecatedpublic static  T withDataInputStream(File file, Closure closure) throws IOException {
public static void traverse(File self, Map options)


trunc

public static float trunc(Float number, int precision)


trunc

public static float trunc(Float number)


trunc

public static double trunc(Double number)


trunc

public static double trunc(Double number, int precision)


unaryMinus

public static Number unaryMinus(Number left)


unexpand

@Deprecated
public static CharSequence unexpand(CharSequence self)


unexpand

@Deprecated
public static CharSequence unexpand(CharSequence self, int tabStop)


unexpand

@Deprecated
public static String unexpand(String self)


unexpand

@Deprecated
public static String unexpand(String self, int tabStop)


unexpandLine

@Deprecated
public static CharSequence unexpandLine(CharSequence self, int tabStop)


unexpandLine

@Deprecated
public static String unexpandLine(String self, int tabStop)


unique

public static Iterator unique(Iterator self)


unique

public static Collection unique(Collection self)


unique

public static Collection unique(Collection self, boolean mutate)


unique

public static Iterator unique(Iterator self, Closure closure)


unique

public static Collection unique(Collection self, Closure closure)


unique

public static Collection unique(Collection self, boolean mutate, Closure closure)


unique

public static Iterator unique(Iterator self, Comparator comparator)
Returns an iterator equivalent to this iterator with all duplicated items removed by using the supplied comparator.
Parameters:
self - an Iterator
comparator - a Comparator
Returns:
the modified Iterator
Since:
1.5.5


unique

public static Collection unique(Collection self, Comparator comparator)


unique

public static Collection unique(Collection self, boolean mutate, Comparator comparator)


upto

public static void upto(Number self, Number to, Closure closure)


upto

public static void upto(long self, Number to, Closure closure)


upto

public static void upto(Long self, Number to, Closure closure)


upto

public static void upto(float self, Number to, Closure closure)


upto

public static void upto(Float self, Number to, Closure closure)
Iterates from this number up to the given number, inclusive, incrementing by one each time.
0.1.upto( 10 ) {
   println it
 }
Prints numbers 0.1, 1.1, 2.1... to 9.1
Parameters:
self - a BigDecimal
to - the end number
closure - the code to execute for each number
Since:
1.0


upto

public static void upto(double self, Number to, Closure closure)


upto

public static void upto(Double self, Number to, Closure closure)
Iterates from this number down to the given number, inclusive, decrementing by one each time.
Parameters:
self - a Number
to - another Number to go down to
closure - the closure to call
Since:
1.0


upto

public static void upto(BigInteger self, Number to, Closure closure)
Iterates from this number down to the given number, inclusive, decrementing by one each time.
Parameters:
self - a long
to - the end number
closure - the code to execute for each number
Since:
1.0


upto

public static void upto(BigDecimal self, Number to, Closure closure)
Iterates from this number down to the given number, inclusive, decrementing by one each time.
Parameters:
self - a Long
to - the end number
closure - the code to execute for each number
Since:
1.0


use

public static Object use(Object self, Class categoryClass, Closure closure)
Scoped use method
Parameters:
self - any Object
categoryClass - a category class to use
closure - the closure to invoke with the category in place
Returns:
the value returned from the closure
Since:
1.0


use

public static Object use(Object self, List categoryClassList, Closure closure)


use

public static Object use(Object self, Object[] array)


with

public static Object with(Object self, Closure closure)


withDataInputStream

@Deprecated
public static Object withDataInputStream(File file, Closure closure)


withDataOutputStream

@Deprecated
public static Object withDataOutputStream(File file, Closure closure)


withDefault

public static Map withDefault(Map self, Closure init)
An alias for withLazyDefault which decorates a list allowing it to grow when called with index values outside the normal list bounds.
Parameters:
self - a List
init - a Closure with the target index as parameter which generates the default value
Returns:
the decorated List
See Also:
withLazyDefault(java.util.List, groovy.lang.Closure)
withEagerDefault(java.util.List, groovy.lang.Closure)
Since:
1.8.7


withDefault

public static List withDefault(List self, Closure init)


withEagerDefault

public static List withEagerDefault(List self, Closure init)
Sorts the Collection. Assumes that the collection items are comparable and uses their natural ordering to determine the resulting order. If the Collection is a List, it is sorted in place and returned. Otherwise, the elements are first placed into a new list which is then sorted and returned - leaving the original Collection unchanged.
assert [1,2,3] == [3,1,2].sort()
Parameters:
self - the collection to be sorted
Returns:
the sorted collection as a List
See Also:
sort(Collection, boolean)
Since:
1.0


withInputStream

@Deprecated
public static Object withInputStream(File file, Closure closure)


withInputStream

@Deprecated
public static Object withInputStream(URL url, Closure closure)


withLazyDefault

public static List withLazyDefault(List self, Closure init)


withObjectInputStream

@Deprecated
public static Object withObjectInputStream(File file, Closure closure)


withObjectInputStream

@Deprecated
public static Object withObjectInputStream(File file, ClassLoader classLoader, Closure closure)


withObjectInputStream

@Deprecated
public static Object withObjectInputStream(InputStream inputStream, Closure closure)


withObjectInputStream

@Deprecated
public static Object withObjectInputStream(InputStream inputStream, ClassLoader classLoader, Closure closure)


withObjectOutputStream

@Deprecated
public static Object withObjectOutputStream(File file, Closure closure)


withObjectOutputStream

@Deprecated
public static Object withObjectOutputStream(OutputStream outputStream, Closure closure)


withObjectStreams

@Deprecated
public static Object withObjectStreams(Socket socket, Closure closure)


withOutputStream

@Deprecated
public static Object withOutputStream(File file, Closure closure)


withPrintWriter

@Deprecated
public static Object withPrintWriter(File file, Closure closure)


withPrintWriter

@Deprecated
public static Object withPrintWriter(File file, String charset, Closure closure)


withPrintWriter

@Deprecated
public static Object withPrintWriter(Writer writer, Closure closure)


withReader

@Deprecated
public static Object withReader(File file, Closure closure)


withReader

@Deprecated
public static Object withReader(File file, String charset, Closure closure)


withReader

@Deprecated
public static Object withReader(Reader reader, Closure closure)


withReader

@Deprecated
public static Object withReader(URL url, Closure closure)


withReader

@Deprecated
public static Object withReader(URL url, String charset, Closure closure)


withReader

@Deprecated
public static Object withReader(InputStream in, Closure closure)


withReader

@Deprecated
public static Object withReader(InputStream in, String charset, Closure closure)


withStream

@Deprecated
public static Object withStream(InputStream stream, Closure closure)


withStream

@Deprecated
public static Object withStream(OutputStream os, Closure closure)


withStreams

@Deprecated
public static Object withStreams(Socket socket, Closure closure)


withWriter

@Deprecated
public static Object withWriter(File file, Closure closure)


withWriter

@Deprecated
public static Object withWriter(File file, String charset, Closure closure)


withWriter

@Deprecated
public static Object withWriter(Writer writer, Closure closure)


withWriter

@Deprecated
public static Object withWriter(OutputStream stream, Closure closure)


withWriter

@Deprecated
public static Object withWriter(OutputStream stream, String charset, Closure closure)


withWriterAppend

@Deprecated
public static Object withWriterAppend(File file, String charset, Closure closure)


withWriterAppend

@Deprecated
public static Object withWriterAppend(File file, Closure closure)


write

@Deprecated
public static void write(Writer self, Writable writable)


write

@Deprecated
public static void write(File file, String text)


write

@Deprecated
public static void write(File file, String text, String charset)


writeLine

@Deprecated
public static void writeLine(BufferedWriter writer, String line)


xor

public static BitSet xor(BitSet left, BitSet right)


xor

public static Number xor(Number left, Number right)


xor

public static Boolean xor(Boolean left, Boolean right)


 

Copyright &copy; 2003-2013 The Codehaus. All rights reserved.