Groovy 2.2.0

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)

static float abs(Float number)

Determine if a Character is uppercase.

static double abs(Double number)

Determine if a Character is lowercase.

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)

static boolean asBoolean(Boolean bool)

static boolean asBoolean(Collection collection)

static boolean asBoolean(Map map)

static boolean asBoolean(Iterator iterator)

static boolean asBoolean(Enumeration enumeration)

static boolean asBoolean(Object[] array)

static boolean asBoolean(byte[] array)

static boolean asBoolean(short[] array)

static boolean asBoolean(int[] array)

static boolean asBoolean(long[] array)

static boolean asBoolean(float[] array)

static boolean asBoolean(double[] array)

static boolean asBoolean(boolean[] array)

static boolean asBoolean(char[] array)

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 list

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)

static List asList(Iterable self)

Coerce an Boolean 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)

Creates a new List with the identical contents to this list but in reverse order.

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 Number bitwiseNegate(Number left)

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)

@deprecated Use the Iterable version of collectEntries instead

static Map collectEntries(Collection self, Closure transform)

static Map collectEntries(Iterator self, Closure transform)

static Map collectEntries(Iterable self, Closure transform)

@deprecated Use the Iterable version of collectEntries instead

static Map collectEntries(Collection self)

static Map collectEntries(Iterator self)

static Map collectEntries(Iterable self)

@deprecated Use the Iterable version of collectEntries instead

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)

@deprecated Use the Iterable version of collectEntries instead

static Map collectEntries(Collection self, Map collector)

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)

@deprecated Use the Iterable version of collectMany instead

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

static List collectMany(Iterable self, Closure projection)

static Collection collectMany(Iterable 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)

static List collectNested(Iterable self, Closure transform)

Deprecated alias for collectNested

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

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

static List combinations(Collection self)

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

static List combinations(Iterable self)

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

static List combinations(Iterable self, Closure function)

Applies a function on each combination of the input lists.

static int compareTo(Character left, Number right)

Multiply a Number by a Character.

static int compareTo(Number left, Character right)

Multiply two Characters.

static int compareTo(Character left, Character right)

static int compareTo(Number left, Number right)

static boolean contains(int[] self, Object 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)

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)

Returns the string representation of the given array.

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)

@deprecated use count(Iterable, Closure)

static Number count(Iterable self, Object value)

@deprecated use count(Iterable, Closure)

static Number count(Collection self, Closure closure)

static Number count(Iterable 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)

static Map countBy(Iterable 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)

static Number div(Character left, Character right)

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)

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

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)

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

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)

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

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)

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

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

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

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 eachCombination(Iterable self, Closure function)

Finds all non-null subsequences of a list.

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)

@deprecated Use the Iterable version of groupBy instead

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)

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)

@deprecated Use the Iterable version of findResults instead

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(Iterable self, Closure filteringTransform)

static Collection findResults(Map self, Closure filteringTransform)

static Object first(List self)

static Object first(Iterable self)

static Object first(Object[] self)

Returns the first item from the Object array.

static Collection flatten(Collection self)

Flatten an array.

static Collection flatten(Iterable self)

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)

static Collection flatten(double[] self)

static Collection flatten(Collection self, Closure flattenUsing)

static Collection flatten(Iterable self, Closure flattenUsing)

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)

static List getAt(ListWithDefault self, Collection indices)

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

static List getAt(ListWithDefault self, Range range)

static List getAt(ListWithDefault self, EmptyRange range)

Support the range subscript operator for a List.

static List getAt(List self, EmptyRange range)

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)

Allows conversion of arrays into a mutable List.

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)

Returns a new Map containing all entries from left and right, giving precedence to right.

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)

Support the subscript operator with an IntRange for a short array

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

Support the subscript operator with an IntRange for an int array

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

Support the subscript operator with an IntRange for a long array

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

Support the subscript operator with an IntRange for a float array

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

Support the subscript operator with an IntRange for a double array

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

Support the subscript operator with an IntRange for a boolean array

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

Support the subscript operator with an ObjectRange for a byte array

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

Support the subscript operator with an ObjectRange for a char array

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

Support the subscript operator with an ObjectRange for a short array

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)

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

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

@deprecated Use the Iterable version of groupBy instead

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

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

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

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

static Map groupBy(Collection self, List closures)

static Map groupBy(Iterable self, List closures)

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

static Map groupBy(Object[] self, List 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)

@deprecated Use the Iterable version of sum instead

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)

static Number intdiv(Number left, Character right)

static Number intdiv(Character left, Character right)

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)

Transform a Number into a Long

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)

@deprecated Use the Iterable version of join instead

static String join(Collection self, String separator)

static String join(Iterable 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)

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(Iterable self)

static Object max(Iterator self)

@deprecated Use the Iterable version of max instead

static Object max(Object[] self)

static Object max(Collection self, Closure closure)

static Object max(Iterable 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)

@deprecated Use the Iterable version of max instead

static Object max(Collection self, Comparator comparator)

static Object max(Iterable self, Comparator comparator)

Selects the maximum value found from the Iterator using the given 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 Collection objects.

static Object min(Iterable self)

static Object min(Iterator self)

@deprecated Use the Iterable version of min instead

static Object min(Object[] self)

Selects the minimum value found in the Iterable using the given comparator.

static Object min(Collection self, Comparator comparator)

static Object min(Iterable self, Comparator comparator)

Selects the minimum value found from the Iterator using the given comparator.

static Object min(Iterator self, Comparator comparator)

@deprecated Use the Iterable version of min instead

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

static Object min(Collection self, Closure closure)

static Object min(Iterable 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)

@deprecated Use the Iterable version of max instead

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)

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)

static Number minus(Character left, Number right)

static Number minus(Number left, Character right)

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)

Set the metaclass for an object.

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 List permutations(List self, Closure function)

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

static Map plus(Map left, Map right)

Support the subscript operator for Collection.

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)

Create a Collection as a union of a Collection and an Iterable.

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)

Create a List composed of the elements of this list, repeated a certain number of times.

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)

Multiply a Character by a Number.

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)

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)

Checks whether the array contains the given value.

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)

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)

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

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)

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)

static Object[] reverse(Object[] self)

Reverses the iterator.

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

static Iterator reverse(Iterator self)

Create an array containing elements from an original array plus an additional appended element.

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)

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)

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)

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

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(Iterable self)

static List sort(Collection self, boolean mutate)

static List sort(Iterable self, boolean mutate)

static Map sort(Map self, Closure closure)

static Map sort(Map self, Comparator comparator)

Modifies this array so that its elements are in sorted order.

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 using the comparator.

static Iterator sort(Iterator self)

@deprecated Use the Iterable version of sort instead

static Iterator sort(Iterator self, Comparator comparator)

static List sort(Collection self, Comparator comparator)

@deprecated Use the Iterable version of sort instead

static List sort(Iterable self, Comparator comparator)

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

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

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

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

static Iterator sort(Iterator self, Closure closure)

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

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

Sorts this Collection using the given Closure to determine the correct ordering.

static List sort(Collection self, Closure closure)

Sorts this Iterable using the given Closure to determine the correct ordering.

static List sort(Iterable self, Closure closure)

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

static List sort(Iterable 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)

Provides an easy way to append multiple Map.Entry values to a Map.

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)

static Object sum(Iterable self)

static Object sum(Object[] self)

@deprecated Use the Iterable version of sum instead

static Object sum(Iterator self)

static Object sum(Collection self, Object initialValue)

static Object sum(Iterable 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 Iterable.

static Object sum(Iterable self, Closure closure)

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(Iterable 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)

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)

Returns an iterator of up to the first num elements from this iterator.

static Iterator take(Iterator self, int num)

static CharSequence take(CharSequence self, int num)

static List takeWhile(List self, Closure condition)

Returns a List containing the longest prefix of the elements from this Iterable where each element passed to the given closure evaluates to true.

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)

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)

static List toList(boolean[] array)

static List toList(char[] array)

static List toList(short[] array)

static List toList(int[] array)

static List toList(long[] array)

static List toList(float[] array)

static List toList(double[] array)

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)

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)

static Set toSet(long[] array)

static Set toSet(float[] array)

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

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)

Checks whether the array contains the given value.

static Set toSet(Enumeration self)

Checks whether the array contains the given value.

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)

Decrement a Number by one.

static String toString(Object[] self)

static String toString(Object value)

Compare a Character and a Number.

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)

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

static Number unaryPlus(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)

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

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)

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)

@deprecated Use the Iterable version of sort instead

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)


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)
Determine if a Character is lowercase. Synonym for 'Character.isLowerCase(this)'.
Parameters:
self - a Character
Returns:
true if the character is lowercase
See Also:
Character.isLowerCase
Since:
1.5.7


accept

@Deprecatedpublic static  T eachLine(InputStream stream, String charset, Closure closure) throws IOException {
public static Socket accept(ServerSocket serverSocket, Closure closure)


accept

@Deprecatedpublic static  T eachLine(InputStream stream, String charset, int firstLine, Closure closure) throws IOException {
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)


asBoolean

public static boolean asBoolean(Boolean bool)


asBoolean

public static boolean asBoolean(Collection collection)


asBoolean

public static boolean asBoolean(Map map)


asBoolean

public static boolean asBoolean(Iterator iterator)


asBoolean

public static boolean asBoolean(Enumeration enumeration)


asBoolean

public static boolean asBoolean(Object[] array)


asBoolean

public static boolean asBoolean(byte[] array)


asBoolean

public static boolean asBoolean(short[] array)


asBoolean

public static boolean asBoolean(int[] array)


asBoolean

public static boolean asBoolean(long[] array)


asBoolean

public static boolean asBoolean(float[] array)


asBoolean

public static boolean asBoolean(double[] array)


asBoolean

public static boolean asBoolean(boolean[] array)


asBoolean

public static boolean asBoolean(char[] array)


asBoolean

public static boolean asBoolean(Character character)


asBoolean

public static boolean asBoolean(Number number)


asBoolean

@Deprecatedreturn StringGroovyMethods.eachMatch(self, regex, closure);
public static boolean asBoolean(CharSequence string)


asBoolean

@Deprecatedreturn StringGroovyMethods.eachMatch(self, pattern, closure);
public static boolean asBoolean(Matcher matcher)


asImmutable

public static Map asImmutable(Map self)
A convenience method for creating an immutable list
Parameters:
self - a List
Returns:
an immutable List
See Also:
Collections.unmodifiableList
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

@Deprecated*/
public static List asList(Collection self)


asList

public static List asList(Iterable self)
Coerce an Boolean instance to a boolean value.
Parameters:
bool - the Boolean
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}
public static Object asType(Collection col, Class clazz)


asType

@SuppressWarnings} catch (GroovyCastException ce) {
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

@SuppressWarningsnew Class[]{clazz},
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

@SuppressWarningsreturn reverse(self, false);
public static Object asType(Map map, Class clazz)
Creates a new List with the identical contents to this list but in reverse order.
 def list = ["a", 4, false]
 assert list.reverse() == [false, 4, "a"]
 assert list == ["a", 4, false]
 
Parameters:
self - a List
Returns:
a reversed List
See Also:
reverse(List, boolean)
Since:
1.0


asType

@SuppressWarnings* @param self    a byte array
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

@SuppressWarningsreturn mc;
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

@Deprecatedreturn StringGroovyMethods.eachMatch(self, pattern, closure);
public static Object asType(CharSequence self, Class c)


asType

@Deprecatedreturn StringGroovyMethods.eachMatch(self, regex, closure);
@SuppressWarnings}
public static Object asType(GString self, Class c)


asType

@Deprecated}
@SuppressWarnings
public static Object asType(String self, Class c)


asType

@Deprecatedpublic static  T withPrintWriter(File file, String charset, Closure closure) throws IOException {
public static Object asType(File f, Class c)


asWritable

@Deprecatedpublic static  T withPrintWriter(File file, Closure closure) throws IOException {
public static File asWritable(File file)


asWritable

@Deprecatedpublic static  T withPrintWriter(Writer writer, Closure closure) throws IOException {
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 Number
to - another Number to go up to
closure - the closure to call
Since:
1.0


bitwiseNegate

public static Number bitwiseNegate(Number left)


bitwiseNegate

@Deprecated
public static Pattern bitwiseNegate(CharSequence self)


bitwiseNegate

@Deprecated
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

@Deprecated
public static CharSequence capitalize(CharSequence self)


capitalize

@Deprecated
public static String capitalize(String self)


center

@Deprecated
public static CharSequence center(CharSequence self, Number numberOfChars)


center

@Deprecated
public static CharSequence center(CharSequence self, Number numberOfChars, CharSequence padding)


center

@Deprecated
public static String center(String self, Number numberOfChars)


center

@Deprecated
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)
deprecated:
Use the Iterable version of collectEntries instead
See Also:
collectEntries(Iterable, Closure)
Since:
1.7.9


collectEntries

@Deprecatedpublic static  Map collectEntries(Iterator self, Closure transform) {
public static Map collectEntries(Collection self, Closure transform)


collectEntries

public static Map collectEntries(Iterator self, Closure transform)


collectEntries

public static Map collectEntries(Iterable self, Closure transform)
deprecated:
Use the Iterable version of collectEntries instead
See Also:
collectEntries(Iterable)
Since:
1.8.5


collectEntries

@Deprecated}
public static Map collectEntries(Collection self)


collectEntries

public static Map collectEntries(Iterator self)


collectEntries

public static Map collectEntries(Iterable self)
deprecated:
Use the Iterable version of collectEntries instead
See Also:
collectEntries(Iterable, Map, Closure)
Since:
1.7.9


collectEntries

@Deprecatedpublic static  Map collectEntries(Iterator self, Map collector, Closure transform) {
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)
deprecated:
Use the Iterable version of collectEntries instead
See Also:
collectEntries(Iterable, Map)
Since:
1.8.5


collectEntries

@Deprecatedpublic static  Map collectEntries(Iterator self, Map collector) {
public static Map collectEntries(Collection self, Map collector)


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

@Deprecated/**
public static List collectMany(Collection self, Closure projection)
deprecated:
Use the Iterable version of collectMany instead
See Also:
collectMany(Iterable, Closure)
Since:
1.8.1


collectMany

@Deprecated* assert smallAnimals == ['cat', 'dog']
public static Collection collectMany(Collection self, Collection collector, Closure projection)


collectMany

public static List collectMany(Iterable self, Closure projection)


collectMany

public static Collection collectMany(Iterable 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)


collectNested

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


collectNested

@Deprecated* @param self      an Iterable
public static Collection collectNested(Collection self, Collection collector, Closure transform)


collectNested

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


combinations

@Deprecatedpublic static List combinations(Iterable self) {
public static List combinations(Collection self)
Adds GroovyCollections#combinations(Iterable) as a method on Iterables.

Example usage:

 assert [['a', 'b'],[1, 2, 3]].combinations() == [['a', 1], ['b', 1], ['a', 2], ['b', 2], ['a', 3], ['b', 3]]
 
Parameters:
self - an Iterable of collections
Returns:
a List of the combinations found
See Also:
GroovyCollections.combinations
Since:
2.2.0


combinations

public static List combinations(Iterable self)
Adds GroovyCollections#combinations(Iterable, Closure) as a method on collections.

Example usage:

assert [[2, 3],[4, 5, 6]].combinations {x,y -> x*y } == [8, 12, 10, 15, 12, 18]
Parameters:
self - a Collection of lists
function - a closure to be called on each combination
Returns:
a List of the results of applying the closure to each combinations found
See Also:
GroovyCollections.combinations
Since:
2.2.0


combinations

public static List combinations(Iterable self, Closure function)
Applies a function on each combination of the input lists.

Example usage:

[[2, 3],[4, 5, 6]].eachCombination { println "Found $it" }
Parameters:
self - a Collection of lists
function - a closure to be called on each combination
See Also:
GroovyCollections.combinations
Since:
2.2.0


compareTo

public static int compareTo(Character left, Number right)
Multiply a Number by a Character. The ordinal value of the Character is used in the multiplication (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 multiplication of left by right
Since:
1.0


compareTo

public static int compareTo(Number left, Character right)
Multiply two Characters. The ordinal values of the Characters are used in the multiplication (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 multiplication of left by right
Since:
1.0


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)


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)


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)
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(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

@Deprecated
public static boolean contains(CharSequence self, CharSequence text)


contains

@Deprecated
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

@Deprecated* @param value the value being searched for
public static Number count(Collection self, Object value)
deprecated:
use count(Iterable, Closure)
Since:
1.0


count

public static Number count(Iterable self, Object value)
deprecated:
use count(Iterable, Closure)
Since:
1.8.0


count

@Deprecated* @since 2.2.0
public static Number count(Collection self, Closure closure)


count

public static Number count(Iterable 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

@Deprecated
public static int count(CharSequence self, CharSequence text)


count

@Deprecated
public static int count(String self, String text)


countBy

@Deprecatedpublic static  Map countBy(Iterable self, Closure closure) {
public static Map countBy(Collection self, Closure closure)


countBy

public static Map countBy(Iterable 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

@Deprecated
protected static StringBufferWriter createStringBufferWriter(StringBuffer self)


createStringWriter

@Deprecated
protected static StringWriter createStringWriter(String self)


deleteDir

@Deprecatedpublic static  T withWriterAppend(File file, String charset, Closure closure) throws IOException {
public static boolean deleteDir(File self)


denormalize

@Deprecatedpublic static List findAll(CharSequence self, Pattern pattern) {
public static CharSequence denormalize(CharSequence self)


denormalize

@Deprecatedpublic static  List findAll(CharSequence self, Pattern pattern, Closure closure) {
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)


div

public static Number div(Character left, Character right)


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 Float
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)
Drops the given number of elements from the head of this Iterable.
 class AbcIterable implements Iterable {
     Iterator iterator() { "abc".iterator() }
 }
 def abc = new AbcIterable()
 assert abc.drop(0) == ['a', 'b', 'c']
 assert abc.drop(1) == ['b', 'c']
 assert abc.drop(3) == []
 assert abc.drop(5) == []
 
Parameters:
self - the original Iterable
num - the number of elements to drop from this Iterable
Returns:
a List consisting of all the elements of this Iterable minus the first num elements, or an empty list if it has less then num elements.
Since:
1.8.7


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)
Drops the given number of key/value pairs from the head of this map if they are available.
 def strings = [ 'a':10, 'b':20, 'c':30 ]
 assert strings.drop( 0 ) == [ 'a':10, 'b':20, 'c':30 ]
 assert strings.drop( 2 ) == [ 'c':30 ]
 assert strings.drop( 5 ) == [:]
 
If the map instance does not have ordered keys, then this function could drop a random num entries. Groovy by default uses LinkedHashMap, so this shouldn't be an issue in the main.
Parameters:
self - the original map
num - the number of elements to drop from this map
Returns:
a map consisting of all key/value pairs of this map except the first num ones, or else the empty map, if this map has less than num elements.
Since:
1.8.1


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

@Deprecatedpublic static List findAll(String self, Pattern pattern) {
public static CharSequence drop(CharSequence self, int num)


dropWhile

public static List dropWhile(List self, Closure condition)
Returns a suffix of this Iterable where elements are dropped from the front while the given closure evaluates to true.
 class AbcIterable implements Iterable {
     Iterator iterator() { "abc".iterator() }
 }
 def abc = new AbcIterable()
 assert abc.dropWhile{ it < 'b' } == ['b', 'c']
 assert abc.dropWhile{ it <= 'b' } == ['c']
 
Parameters:
self - an Iterable
condition - the closure that must evaluate to true to continue dropping elements
Returns:
the shortest suffix of the given Iterable such that the given closure condition evaluates to true for each element dropped from the front of the Iterable
Since:
1.8.7


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)
Create a suffix of the given array by dropping as many elements as possible from the front of the original array such that calling the given closure condition evaluates to true when passed each of the dropped elements.
 def nums = [ 1, 3, 2 ] as Integer[]
 assert nums.dropWhile{ it <= 3 } == [ ] as Integer[]
 assert nums.dropWhile{ it < 3 } == [ 3, 2 ] as Integer[]
 assert nums.dropWhile{ it != 2 } == [ 2 ] as Integer[]
 assert nums.dropWhile{ it == 0 } == [ 1, 3, 2 ] as Integer[]
 
Parameters:
self - the original array
condition - the closure that must evaluate to true to continue dropping elements
Returns:
the shortest suffix of the given array such that the given closure condition evaluates to true for each element dropped from the front of the array
Since:
1.8.7


dropWhile

public static Object[] dropWhile(Object[] self, Closure condition)
Creates an Iterator that returns a suffix of the elements from an original Iterator. As many elements as possible are dropped from the front of the original Iterator such that calling the given closure condition evaluates to true when passed each of the dropped elements.
 def a = 0
 def iter = [ hasNext:{ a < 10 }, next:{ a++ } ] as Iterator
 assert [].iterator().dropWhile{ it < 3 }.toList() == []
 assert [1, 2, 3, 4, 5].iterator().dropWhile{ it < 3 }.toList() == [ 3, 4, 5 ]
 assert iter.dropWhile{ it < 5 }.toList() == [ 5, 6, 7, 8, 9 ]
 
Parameters:
self - the Iterator
condition - the closure that must evaluate to true to continue dropping elements
Returns:
the shortest suffix of elements from the given Iterator such that the given closure condition evaluates to true for each element dropped from the front of the Iterator
Since:
1.8.7


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)


eachCombination

public static void eachCombination(Iterable self, Closure function)
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


eachDir

@Deprecatedpublic static Object withOutputStream(File file, Closure closure) throws IOException {
public static void eachDir(File self, Closure closure)


eachDirMatch

@Deprecatedpublic static  T withWriter(File file, String charset, Closure closure) throws IOException {
public static void eachDirMatch(File self, Object nameFilter, Closure closure)


eachDirRecurse

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


eachFile

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


eachFile

@Deprecatedpublic static DataOutputStream newDataOutputStream(File file) throws IOException {
public static void eachFile(File self, Closure closure)


eachFileMatch

@Deprecated
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

@Deprecatedpublic static Object withInputStream(File file, Closure closure) throws IOException {
public static void eachFileRecurse(File self, FileType fileType, Closure closure)


eachFileRecurse

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


eachLine

@Deprecatedreturn StringGroovyMethods.findAll(self, pattern, closure);
public static Object eachLine(CharSequence self, Closure closure)


eachLine

@Deprecatedreturn StringGroovyMethods.findAll(self, regex);
public static Object eachLine(CharSequence self, int firstLine, Closure closure)


eachLine

@Deprecatedreturn StringGroovyMethods.findAll(self, regex, closure);
public static Object eachLine(String self, Closure closure)


eachLine

@Deprecatedreturn StringGroovyMethods.getAt(self, indices);
public static Object eachLine(String self, int firstLine, Closure closure)


eachLine

@Deprecatedreturn IOGroovyMethods.splitEachLine(stream, pattern, closure);
public static Object eachLine(File self, Closure closure)


eachLine

@Deprecatedreturn  IOGroovyMethods.readLine(self);
public static Object eachLine(File self, String charset, Closure closure)


eachLine

@Deprecatedreturn ResourceGroovyMethods.readLines(file);
public static Object eachLine(File self, int firstLine, Closure closure)


eachLine

@Deprecatedreturn ResourceGroovyMethods.readLines(file, charset);
public static Object eachLine(File self, String charset, int firstLine, Closure closure)


eachLine

@Deprecatedreturn IOGroovyMethods.readLines(stream);
public static Object eachLine(InputStream stream, String charset, Closure closure)


eachLine

@Deprecatedreturn IOGroovyMethods.readLines(stream, charset);
public static Object eachLine(InputStream stream, String charset, int firstLine, Closure closure)


eachLine

@Deprecatedreturn ResourceGroovyMethods.readLines(self);
public static Object eachLine(InputStream stream, Closure closure)


eachLine

@Deprecatedreturn ResourceGroovyMethods.readLines(self, charset);
public static Object eachLine(InputStream stream, int firstLine, Closure closure)


eachLine

@Deprecatedreturn IOGroovyMethods.readLines(reader);
public static Object eachLine(URL url, Closure closure)


eachLine

@Deprecatedreturn ResourceGroovyMethods.getText(file, charset);
public static Object eachLine(URL url, int firstLine, Closure closure)


eachLine

@Deprecatedreturn ResourceGroovyMethods.getText(file);
public static Object eachLine(URL url, String charset, Closure closure)


eachLine

@Deprecatedreturn ResourceGroovyMethods.getText(url);
public static Object eachLine(URL url, String charset, int firstLine, Closure closure)


eachLine

@Deprecatedreturn ResourceGroovyMethods.getText(url, parameters);
public static Object eachLine(Reader self, Closure closure)


eachLine

@Deprecatedreturn ResourceGroovyMethods.getText(url, charset);
public static Object eachLine(Reader self, int firstLine, Closure closure)


eachMatch

@Deprecatedreturn StringGroovyMethods.getAt(text, range);
public static String eachMatch(CharSequence self, CharSequence regex, Closure closure)


eachMatch

@Deprecatedreturn StringGroovyMethods.getAt(text, index);
public static String eachMatch(CharSequence self, Pattern pattern, Closure closure)


eachMatch

@Deprecatedreturn StringGroovyMethods.getAt(text, range);
public static String eachMatch(String self, Pattern pattern, Closure closure)


eachMatch

@Deprecatedreturn StringGroovyMethods.getAt(text, range);
public static String eachMatch(String self, String regex, Closure closure)


eachObject

@Deprecatedreturn ResourceGroovyMethods.splitEachLine(self, pattern, charset, closure);
public static void eachObject(File self, Closure closure)


eachObject

@Deprecatedreturn IOGroovyMethods.splitEachLine(self, regex, closure);
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

@Deprecatedpublic static ObjectInputStream newObjectInputStream(InputStream inputStream) throws IOException {
public static Process execute(String self)


execute

@Deprecatedpublic static ObjectInputStream newObjectInputStream(InputStream inputStream, final ClassLoader classLoader) throws IOException {
public static Process execute(String self, String[] envp, File dir)


execute

@Deprecatedpublic static ObjectInputStream newObjectInputStream(File file, final ClassLoader classLoader) throws IOException {
public static Process execute(String self, List envp, File dir)


execute

@Deprecatedpublic static void eachObject(File self, Closure closure) throws IOException, ClassNotFoundException {
public static Process execute(String[] commandArray)


execute

@Deprecatedpublic static void eachObject(ObjectInputStream ois, Closure closure) throws IOException, ClassNotFoundException {
public static Process execute(String[] commandArray, String[] envp, File dir)


execute

@Deprecatedpublic static  T withObjectInputStream(File file, Closure closure) throws IOException {
public static Process execute(String[] commandArray, List envp, File dir)


execute

@Deprecatedpublic static  T withObjectInputStream(File file, ClassLoader classLoader, Closure closure) throws IOException {
public static Process execute(List commands)


execute

@Deprecatedpublic static  T withObjectInputStream(InputStream inputStream, Closure closure) throws IOException {
public static Process execute(List commands, String[] envp, File dir)


execute

@Deprecatedpublic static  T withObjectInputStream(InputStream inputStream, ClassLoader classLoader, Closure closure) throws IOException {
public static Process execute(List commands, List envp, File dir)


expand

@Deprecatedreturn StringGroovyMethods.getAt(self, indices);
public static CharSequence expand(CharSequence self)


expand

@Deprecatedreturn StringGroovyMethods.getAt(matcher, idx);
public static CharSequence expand(CharSequence self, int tabStop)


expand

@Deprecatedreturn StringGroovyMethods.getAt(self, indices);
public static String expand(String self)


expand

@Deprecatedreturn StringGroovyMethods.getAt(text, range);
public static String expand(String self, int tabStop)


expandLine

@Deprecatedreturn StringGroovyMethods.getAt(text, index);
public static CharSequence expandLine(CharSequence self, int tabStop)


expandLine

@Deprecatedreturn StringGroovyMethods.getAt(text, range);
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

@Deprecatedreturn StringGroovyMethods.getAt(text, range);
public static CharSequence find(CharSequence self, CharSequence regex)


find

@Deprecatedreturn StringGroovyMethods.getChars(self);
public static CharSequence find(CharSequence self, CharSequence regex, Closure closure)


find

@Deprecatedreturn StringGroovyMethods.getChars(self);
public static CharSequence find(CharSequence self, Pattern pattern)


find

@Deprecatedreturn StringGroovyMethods.getCount(matcher);
public static CharSequence find(CharSequence self, Pattern pattern, Closure closure)


find

@Deprecatedreturn StringGroovyMethods.hasGroup(matcher);
public static String find(String self, Pattern pattern)


find

@Deprecatedreturn StringGroovyMethods.isAllWhitespace(self);
public static String find(String self, Pattern pattern, Closure closure)


find

@Deprecatedreturn StringGroovyMethods.isAllWhitespace(self);
public static String find(String self, String regex)


find

@Deprecatedreturn StringGroovyMethods.isBigDecimal(self);
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)
deprecated:
Use the Iterable version of groupBy instead
See Also:
groupBy(Iterable, Closure)
Since:
1.0


findAll

@Deprecatedreturn StringGroovyMethods.isBigDecimal(self);
public static List findAll(CharSequence self, CharSequence regex)


findAll

@Deprecatedreturn StringGroovyMethods.isBigInteger(self);
public static List findAll(CharSequence self, CharSequence regex, Closure closure)


findAll

@Deprecatedreturn StringGroovyMethods.isBigInteger(self);
public static List findAll(CharSequence self, Pattern pattern)


findAll

@Deprecatedreturn StringGroovyMethods.isCase(caseValue, switchValue);
public static List findAll(CharSequence self, Pattern pattern, Closure closure)


findAll

@Deprecatedreturn StringGroovyMethods.isCase(caseValue, switchValue);
public static List findAll(String self, Pattern pattern)


findAll

@Deprecatedreturn StringGroovyMethods.isCase(caseValue, switchValue);
public static List findAll(String self, Pattern pattern, Closure closure)


findAll

@Deprecatedreturn StringGroovyMethods.isCase(caseValue, switchValue);
public static List findAll(String self, String regex)


findAll

@Deprecatedreturn StringGroovyMethods.isDouble(self);
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)


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)
deprecated:
Use the Iterable version of findResults instead
See Also:
findResults(Iterable, Closure)
Since:
1.8.1


findResult

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


findResult

public static Object findResult(Map self, Closure closure)


findResults

@Deprecated* @return the list of non-null transformed values
public static Collection findResults(Collection self, Closure filteringTransform)


findResults

public static Collection findResults(Iterable 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)


first

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


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 boolean Array to flatten
Returns:
a flattened Collection
Since:
1.6.0


flatten

public static Collection flatten(Iterable self)


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

public static Collection flatten(double[] self)


flatten

public static Collection flatten(Collection self, Closure flattenUsing)


flatten

public static Collection flatten(Iterable self, Closure flattenUsing)


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)


getAt

public static List getAt(ListWithDefault self, Collection indices)
Support the range subscript operator for an eager or lazy List.
def list = [].withDefault { 42 }
 assert list[1..2] == [null, 42]
Parameters:
self - a ListWithDefault
range - a Range indicating the items to get
Returns:
a new eager or lazy list instance based on range borders


getAt

public static List getAt(ListWithDefault self, Range range)


getAt

public static List getAt(ListWithDefault self, EmptyRange 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 new list instance based on range borders
Since:
1.0


getAt

public static List getAt(List self, EmptyRange range)


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)
Allows conversion of arrays into a mutable List.
Parameters:
array - an Array of Objects
Returns:
the array as a List
Since:
1.0


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)
Returns a new Map containing all entries from left and right, giving precedence to right. Any keys appearing in both Maps will appear in the resultant map with values from the right operand. If the left map is one of TreeMap, LinkedHashMap, Hashtable or Properties, the returned Map will preserve that type, otherwise a HashMap will be returned.

Roughly equivalent to Map m = new HashMap(); m.putAll(left); m.putAll(right); return m; but with some additional logic to preserve the left Map type for common cases as described above.

 assert [a:10, b:20] + [a:5, c:7] == [a:5, b:20, c:7]
 
Parameters:
left - a Map
right - a Map
Returns:
a new Map containing all entries from left and right
Since:
1.5.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* @param range a range indicating the indices for the items to retrieve
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* @param range a range indicating the indices for the items to retrieve
public static List getAt(char[] array, Range range)


getAt

@SuppressWarnings* @param range a range indicating the indices for the items to retrieve
public static List getAt(short[] array, Range range)


getAt

@SuppressWarnings* @param range a range indicating the indices for the items to retrieve
public static List getAt(int[] array, Range range)


getAt

@SuppressWarnings* @param range an IntRange indicating the indices for the items to retrieve
public static List getAt(long[] array, Range range)


getAt

@SuppressWarnings*
public static List getAt(float[] array, Range range)


getAt

@SuppressWarnings/**
public static List getAt(double[] array, Range range)


getAt

@SuppressWarnings}
public static List getAt(boolean[] array, Range range)
Support the subscript operator with an IntRange for a short array
Parameters:
array - a short array
range - an IntRange indicating the indices for the items to retrieve
Returns:
list of the retrieved shorts
Since:
1.0


getAt

@SuppressWarningsList answer = primitiveArrayGet(array, new IntRange(true, info.from, info.to - 1));
public static List getAt(byte[] array, IntRange range)
Support the subscript operator with an IntRange for an int array
Parameters:
array - an int array
range - an IntRange indicating the indices for the items to retrieve
Returns:
list of the retrieved ints
Since:
1.0


getAt

@SuppressWarningsList answer = primitiveArrayGet(array, new IntRange(true, info.from, info.to - 1));
public static List getAt(char[] array, IntRange range)
Support the subscript operator with an IntRange for a long array
Parameters:
array - a long array
range - an IntRange indicating the indices for the items to retrieve
Returns:
list of the retrieved longs
Since:
1.0


getAt

@SuppressWarningsList answer = primitiveArrayGet(array, new IntRange(true, info.from, info.to - 1));
public static List getAt(short[] array, IntRange range)
Support the subscript operator with an IntRange for a float array
Parameters:
array - a float array
range - an IntRange indicating the indices for the items to retrieve
Returns:
list of the retrieved floats
Since:
1.0


getAt

@SuppressWarningsList answer = primitiveArrayGet(array, new IntRange(true, info.from, info.to - 1));
public static List getAt(int[] array, IntRange range)
Support the subscript operator with an IntRange for a double array
Parameters:
array - a double array
range - an IntRange indicating the indices for the items to retrieve
Returns:
list of the retrieved doubles
Since:
1.0


getAt

@SuppressWarningsList answer = primitiveArrayGet(array, new IntRange(true, info.from, info.to - 1));
public static List getAt(long[] array, IntRange range)
Support the subscript operator with an IntRange for a boolean array
Parameters:
array - a boolean array
range - an IntRange indicating the indices for the items to retrieve
Returns:
list of the retrieved booleans
Since:
1.0


getAt

@SuppressWarnings}
public static List getAt(float[] array, IntRange range)
Support the subscript operator with an ObjectRange for a byte array
Parameters:
array - a byte array
range - an ObjectRange indicating the indices for the items to retrieve
Returns:
list of the retrieved bytes
Since:
1.0


getAt

@SuppressWarnings/**
public static List getAt(double[] array, IntRange range)
Support the subscript operator with an ObjectRange for a char array
Parameters:
array - a char array
range - an ObjectRange indicating the indices for the items to retrieve
Returns:
list of the retrieved chars
Since:
1.0


getAt

@SuppressWarnings*
public static List getAt(boolean[] array, IntRange range)
Support the subscript operator with an ObjectRange for a short array
Parameters:
array - a short array
range - an ObjectRange indicating the indices for the items to retrieve
Returns:
list of the retrieved shorts
Since:
1.0


getAt

@SuppressWarnings* @param range an ObjectRange indicating the indices for the items to retrieve
public static List getAt(byte[] array, ObjectRange range)


getAt

@SuppressWarnings* @param range an ObjectRange indicating the indices for the items to retrieve
public static List getAt(char[] array, ObjectRange range)


getAt

@SuppressWarnings* @param range an ObjectRange indicating the indices for the items to retrieve
public static List getAt(short[] array, ObjectRange range)


getAt

@SuppressWarnings* @param range an ObjectRange indicating the indices for the items to retrieve
public static List getAt(int[] array, ObjectRange range)


getAt

@SuppressWarnings* @param indices a collection of indices for the items to retrieve
public static List getAt(long[] array, ObjectRange range)


getAt

@SuppressWarnings* @param indices a collection of indices for the items to retrieve
public static List getAt(float[] array, ObjectRange range)


getAt

@SuppressWarnings* @param indices a collection of indices for the items to retrieve
public static List getAt(double[] array, ObjectRange range)


getAt

@SuppressWarnings* @param indices a collection of indices for the items to retrieve
public static List getAt(boolean[] array, ObjectRange range)


getAt

@SuppressWarnings* @param indices a collection of indices for the items to retrieve
public static List getAt(byte[] array, Collection indices)


getAt

@SuppressWarnings* @param indices a collection of indices for the items to retrieve
public static List getAt(char[] array, Collection indices)


getAt

@SuppressWarnings* @param indices a collection of indices for the items to retrieve
public static List getAt(short[] array, Collection indices)


getAt

@SuppressWarnings* @param indices a collection of indices for the items to retrieve
public static List getAt(int[] array, Collection indices)


getAt

@SuppressWarnings* @param index index to retrieve
public static List getAt(long[] array, Collection indices)


getAt

@SuppressWarnings* @param self  a BitSet
public static List getAt(float[] array, Collection indices)


getAt

@SuppressWarningsint offset = info.from;
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

@Deprecatedreturn StringGroovyMethods.isDouble(self);
public static CharSequence getAt(CharSequence self, Collection indices)


getAt

@Deprecatedreturn StringGroovyMethods.isFloat(self);
public static CharSequence getAt(CharSequence text, EmptyRange range)


getAt

@Deprecatedreturn StringGroovyMethods.isFloat(self);
public static CharSequence getAt(CharSequence text, int index)


getAt

@Deprecatedreturn StringGroovyMethods.isInteger(self);
public static CharSequence getAt(CharSequence text, IntRange range)


getAt

@Deprecatedreturn StringGroovyMethods.isInteger(self);
public static CharSequence getAt(CharSequence text, Range range)


getAt

@Deprecatedreturn StringGroovyMethods.isLong(self);
public static List getAt(Matcher self, Collection indices)


getAt

@Deprecatedreturn StringGroovyMethods.isLong(self);
public static Object getAt(Matcher matcher, int idx)


getAt

@Deprecatedreturn StringGroovyMethods.isNumber(self);
public static String getAt(String self, Collection indices)


getAt

@Deprecatedreturn StringGroovyMethods.isNumber(self);
public static String getAt(String text, EmptyRange range)


getAt

@Deprecatedreturn StringGroovyMethods.iterator(matcher);
public static String getAt(String text, int index)


getAt

@Deprecatedreturn StringGroovyMethods.leftShift(self, value);
public static String getAt(String text, IntRange range)


getAt

@Deprecatedreturn StringGroovyMethods.leftShift(self, value);
public static String getAt(String text, Range range)


getBytes

@DeprecatedResourceGroovyMethods.eachFileMatch(self, fileType, nameFilter, closure);
public static byte[] getBytes(File file)


getBytes

@Deprecatedthrows FileNotFoundException, IllegalArgumentException {
public static byte[] getBytes(URL url)


getBytes

@Deprecatedpublic static void eachDirMatch(final File self, final Object nameFilter, final Closure closure) throws FileNotFoundException, IllegalArgumentException {
public static byte[] getBytes(InputStream is)


getChars

@Deprecatedreturn StringGroovyMethods.leftShift(self, value);
public static char[] getChars(CharSequence self)


getChars

@Deprecatedreturn StringGroovyMethods.leftShift(self, value);
public static char[] getChars(String self)


getCount

@Deprecatedreturn StringGroovyMethods.matches(self, pattern);
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)


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

@Deprecatedthrows FileNotFoundException, IllegalArgumentException {
public static String getText(File file, String charset)


getText

@Deprecatedpublic static void eachFile(final File self, final Closure closure) throws FileNotFoundException, IllegalArgumentException {
public static String getText(File file)


getText

@Deprecatedpublic static void eachDir(File self, Closure closure) throws FileNotFoundException, IllegalArgumentException {
public static String getText(URL url)


getText

@Deprecatedpublic static void eachFileRecurse(final File self, final FileType fileType, final Closure closure)
public static String getText(URL url, Map parameters)


getText

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


getText

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


getText

@Deprecated
public static String getText(InputStream is)


getText

@Deprecated}
public static String getText(InputStream is, String charset)


getText

@Deprecated}
public static String getText(Reader reader)


getText

@Deprecated}
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

@Deprecated* @return a new Map grouped by keys
public static Map groupBy(Collection self, Closure closure)


groupBy

public static Map groupBy(Iterable self, Closure closure)


groupBy

public static Map groupBy(Object[] self, Closure closure)
deprecated:
Use the Iterable version of groupBy instead
See Also:
groupBy(Iterable, Object...)
Since:
1.8.1


groupBy

@Deprecated* def data = sql.rows("SELECT * FROM a_table").groupBy({ it.column1 }, { it.column2 }, { it.column3 })
public static Map groupBy(Collection self, Object... closures)


groupBy

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


groupBy

public static Map groupBy(Object[] self, Object... closures)
Sorts all array members into (sub)groups determined by the supplied mapping closures as per the Iterable variant of this method.
Parameters:
self - an array to group
closures - an array of closures, each mapping entries on keys
Returns:
a new Map grouped by keys on each criterion
See Also:
groupBy(Iterable, Object...)
Closure.IDENTITY
Since:
2.2.0


groupBy

public static Map groupBy(Collection self, List closures)


groupBy

public static Map groupBy(Iterable self, List closures)
Sorts all array members into (sub)groups determined by the supplied mapping closures as per the list variant of this method.
Parameters:
self - an array 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
groupBy(Iterable, List)
Since:
2.2.0


groupBy

public static Map groupBy(Object[] self, List closures)


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

@Deprecatedreturn StringGroovyMethods.matches(self, pattern);
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)
deprecated:
Use the Iterable version of sum instead
See Also:
sum(Iterable)
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)


intdiv

public static Number intdiv(Number left, Character right)


intdiv

public static Number intdiv(Character left, Character right)


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

@Deprecatedreturn StringGroovyMethods.minus(self, target);
public static boolean isAllWhitespace(CharSequence self)


isAllWhitespace

@Deprecatedreturn StringGroovyMethods.minus(self, target);
public static boolean isAllWhitespace(String self)


isBigDecimal

@Deprecatedreturn StringGroovyMethods.multiply(self, factor);
public static boolean isBigDecimal(CharSequence self)


isBigDecimal

@Deprecatedreturn StringGroovyMethods.multiply(self, factor);
public static boolean isBigDecimal(String self)


isBigInteger

@Deprecatedreturn StringGroovyMethods.next(self);
public static boolean isBigInteger(CharSequence self)


isBigInteger

@Deprecatedreturn StringGroovyMethods.next(self);
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

@Deprecatedreturn StringGroovyMethods.normalize(self);
public static boolean isCase(CharSequence caseValue, Object switchValue)


isCase

@Deprecatedreturn StringGroovyMethods.normalize(self);
public static boolean isCase(GString caseValue, Object switchValue)


isCase

@Deprecatedreturn StringGroovyMethods.padLeft(self, numberOfChars);
public static boolean isCase(Pattern caseValue, Object switchValue)


isCase

@Deprecatedreturn StringGroovyMethods.padLeft(self, numberOfChars, padding);
public static boolean isCase(String caseValue, Object switchValue)


isDigit

public static boolean isDigit(Character self)


isDouble

@Deprecatedreturn StringGroovyMethods.padLeft(self, numberOfChars);
public static boolean isDouble(CharSequence self)


isDouble

@Deprecatedreturn StringGroovyMethods.padLeft(self, numberOfChars, padding);
public static boolean isDouble(String self)


isFloat

@Deprecatedreturn StringGroovyMethods.padRight(self, numberOfChars);
public static boolean isFloat(CharSequence self)


isFloat

@Deprecatedreturn StringGroovyMethods.padRight(self, numberOfChars, padding);
public static boolean isFloat(String self)


isInteger

@Deprecatedreturn StringGroovyMethods.padRight(self, numberOfChars);
public static boolean isInteger(CharSequence self)


isInteger

@Deprecatedreturn StringGroovyMethods.padRight(self, numberOfChars, padding);
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

@Deprecatedreturn StringGroovyMethods.plus(left, value);
public static boolean isLong(CharSequence self)


isLong

@Deprecatedreturn StringGroovyMethods.plus(value, right);
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

@Deprecatedreturn StringGroovyMethods.plus(left, value);
public static boolean isNumber(CharSequence self)


isNumber

@Deprecatedreturn StringGroovyMethods.plus(left, value);
public static boolean isNumber(String self)


isUpperCase

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


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

@Deprecatedreturn StringGroovyMethods.previous(self);
public static Iterator iterator(Matcher matcher)


iterator

@Deprecatedpublic static PrintWriter newPrintWriter(File file) throws IOException {
public static Iterator iterator(Reader self)


iterator

@Deprecatedpublic static PrintWriter newPrintWriter(File file, String charset) throws IOException {
public static Iterator iterator(InputStream self)


iterator

@Deprecatedpublic static PrintWriter newPrintWriter(Writer writer) {
public static Iterator iterator(DataInputStream self)


join

public static String join(Iterator self, String separator)
deprecated:
Use the Iterable version of join instead
See Also:
join(Iterable, String)
Since:
1.0


join

@Deprecated} else {
public static String join(Collection self, String separator)


join

public static String join(Iterable 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)


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

@Deprecatedreturn StringGroovyMethods.previous(self);
public static StringBuilder leftShift(CharSequence self, Object value)


leftShift

@DeprecatedStringGroovyMethods.putAt(self, range, value);
public static StringBuffer leftShift(String self, Object value)


leftShift

@DeprecatedStringGroovyMethods.putAt(self, range, value);
public static StringBuffer leftShift(StringBuffer self, Object value)


leftShift

@Deprecatedreturn StringGroovyMethods.readLines(self);
public static StringBuilder leftShift(StringBuilder self, Object value)


leftShift

@Deprecatedpublic static  T eachLine(File self, int firstLine, Closure closure) throws IOException {
public static Writer leftShift(Socket self, Object value)


leftShift

@Deprecatedpublic static  T eachLine(File self, String charset, int firstLine, Closure closure) throws IOException {
public static OutputStream leftShift(Socket self, byte[] value)


leftShift

@Deprecatedreturn IOGroovyMethods.eachLine(stream, firstLine, closure);
public static Writer leftShift(Writer self, Object value)


leftShift

@Deprecatedreturn ResourceGroovyMethods.eachLine(url, firstLine, closure);
public static Writer leftShift(OutputStream self, Object value)


leftShift

@Deprecatedreturn ResourceGroovyMethods.eachLine(url, charset, closure);
public static void leftShift(ObjectOutputStream self, Object value)


leftShift

@Deprecatedreturn ResourceGroovyMethods.eachLine(url, charset, firstLine, closure);
public static OutputStream leftShift(OutputStream self, InputStream in)


leftShift

@Deprecatedreturn IOGroovyMethods.eachLine(self, closure);
public static OutputStream leftShift(OutputStream self, byte[] value)


leftShift

@Deprecatedpublic static  T asType(File f, Class c) {
public static File leftShift(File file, Object text)


leftShift

@Deprecatedpublic static File asWritable(File file, String encoding) {
public static File leftShift(File file, byte[] bytes)


leftShift

@Deprecatedpublic static BufferedReader newReader(File file) throws IOException {
public static File leftShift(File file, InputStream data)


matches

@Deprecatedreturn StringGroovyMethods.readLines(self);
public static boolean matches(CharSequence self, Pattern pattern)


matches

@Deprecatedreturn StringGroovyMethods.replaceAll(self, regex, replacement);
public static boolean matches(String self, Pattern pattern)


max

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


max

@Deprecated* @param self an Iterator
public static Object max(Collection self)


max

public static Object max(Iterable self)


max

public static Object max(Iterator self)
deprecated:
Use the Iterable version of max instead
See Also:
max(Iterable, Closure)
Since:
1.0


max

public static Object max(Object[] self)


max

@Deprecated* assert longestName.size() == 8
public static Object max(Collection self, Closure closure)


max

public static Object max(Iterable 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)
deprecated:
Use the Iterable version of max instead
See Also:
max(Iterable, Comparator)
Since:
1.0


max

@Deprecated}
public static Object max(Collection self, Comparator comparator)


max

public static Object max(Iterable self, Comparator comparator)
Selects the maximum value found from the Iterator using the given comparator.
Parameters:
self - an Iterator
comparator - a Comparator
Returns:
the maximum value
Since:
1.5.5


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 Collection objects.
assert 2 == [4,2,5].min()
Parameters:
self - a Collection
Returns:
the minimum value
See Also:
GroovyCollections.min
Since:
1.0


min

public static Object min(Iterable self)


min

public static Object min(Iterator self)
deprecated:
Use the Iterable version of min instead
See Also:
min(Iterable, Comparator)
Since:
1.0


min

public static Object min(Object[] self)
Selects the minimum value found in the Iterable using the given comparator.
assert "hi" == ["hello","hi","hey"].min( { a, b -> a.length() <=> b.length() } as Comparator )
Parameters:
self - an Iterable
comparator - a Comparator
Returns:
the minimum value
Since:
2.2.0


min

@Deprecated/**
public static Object min(Collection self, Comparator comparator)


min

public static Object min(Iterable self, Comparator comparator)
Selects the minimum value found from the Iterator using the given comparator.
Parameters:
self - an Iterator
comparator - a Comparator
Returns:
the minimum value
See Also:
min(java.util.Collection, java.util.Comparator)
Since:
1.5.5


min

public static Object min(Iterator self, Comparator comparator)
deprecated:
Use the Iterable version of min instead
See Also:
min(Iterable, Closure)
Since:
1.0


min

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


min

@Deprecated* assert [19, 55, 91].min(lastDigit) == 91
public static Object min(Collection self, Closure closure)


min

public static Object min(Iterable 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)
deprecated:
Use the Iterable version of max instead
See Also:
max(Iterable)
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)


minus

@SuppressWarnings// element it encounters.
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 (numberComparator.compare(t, (T)t2) == 0)
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* 
assert [1,2,3,4,5] == [1,[2,3],[[4]],[],5].flatten()
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)


minus

public static Number minus(Character left, Number right)


minus

public static Number minus(Number left, Character right)


minus

public static Number minus(Character left, Character right)


minus

@Deprecatedreturn StringGroovyMethods.replaceAll(self, regex, closure);
public static CharSequence minus(CharSequence self, Object target)


minus

@Deprecatedreturn StringGroovyMethods.replaceAll(self, pattern, replacement);
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

@Deprecatedreturn StringGroovyMethods.replaceAll(self, pattern, closure);
public static CharSequence multiply(CharSequence self, Number factor)


multiply

@Deprecatedreturn StringGroovyMethods.replaceAll(self, pattern, closure);
public static String multiply(String self, Number factor)


newDataInputStream

@Deprecated
public static DataInputStream newDataInputStream(File file)


newDataOutputStream

@Deprecatedreturn IOGroovyMethods.withWriter(stream, closure);
public static DataOutputStream newDataOutputStream(File file)


newInputStream

@Deprecatedreturn ResourceGroovyMethods.filterLine(self, charset, predicate);
public static BufferedInputStream newInputStream(File file)


newInputStream

@DeprecatedResourceGroovyMethods.filterLine(self, writer, predicate);
public static BufferedInputStream newInputStream(URL url)


newInputStream

@DeprecatedResourceGroovyMethods.filterLine(self, writer, charset, predicate);
public static BufferedInputStream newInputStream(URL url, Map parameters)


newInstance

@SuppressWarnings/**
public static Object newInstance(Class c)
Set the metaclass for an object.
Parameters:
self - the object whose metaclass we want to set
metaClass - the new metaclass value
Since:
1.6.0


newInstance

@SuppressWarnings}
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

@Deprecatedreturn ResourceGroovyMethods.splitEachLine(self, pattern, charset, closure);
public static ObjectInputStream newObjectInputStream(File file)


newObjectInputStream

@Deprecatedreturn ResourceGroovyMethods.splitEachLine(self, regex, closure);
public static ObjectInputStream newObjectInputStream(InputStream inputStream)


newObjectInputStream

@Deprecatedreturn ResourceGroovyMethods.splitEachLine(self, pattern, closure);
public static ObjectInputStream newObjectInputStream(InputStream inputStream, ClassLoader classLoader)


newObjectInputStream

@Deprecatedreturn ResourceGroovyMethods.splitEachLine(self, regex, charset, closure);
public static ObjectInputStream newObjectInputStream(File file, ClassLoader classLoader)


newObjectOutputStream

@Deprecatedreturn IOGroovyMethods.eachLine(self, firstLine, closure);
public static ObjectOutputStream newObjectOutputStream(File file)


newObjectOutputStream

@Deprecatedreturn ResourceGroovyMethods.splitEachLine(self, regex, closure);
public static ObjectOutputStream newObjectOutputStream(OutputStream outputStream)


newOutputStream

@Deprecatedreturn IOGroovyMethods.withReader(in, charset, closure);
public static BufferedOutputStream newOutputStream(File file)


newPrintWriter

@DeprecatedIOGroovyMethods.eachByte(is, bufferLen, closure);
public static PrintWriter newPrintWriter(File file)


newPrintWriter

@DeprecatedResourceGroovyMethods.eachByte(url, closure);
public static PrintWriter newPrintWriter(File file, String charset)


newPrintWriter

@DeprecatedResourceGroovyMethods.eachByte(url, bufferLen, closure);
public static PrintWriter newPrintWriter(Writer writer)


newReader

@Deprecatedpublic static  T withWriter(Writer writer, Closure closure) throws IOException {
public static BufferedReader newReader(File file)


newReader

@Deprecatedpublic static  T withReader(Reader reader, Closure closure) throws IOException {
public static BufferedReader newReader(File file, String charset)


newReader

@Deprecatedreturn IOGroovyMethods.withStream(stream, closure);
public static BufferedReader newReader(InputStream self)


newReader

@Deprecatedreturn ResourceGroovyMethods.withReader(url, closure);
public static BufferedReader newReader(InputStream self, String charset)


newReader

@Deprecatedreturn ResourceGroovyMethods.readBytes(file);
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

@Deprecatedreturn ResourceGroovyMethods.newReader(url);
public static BufferedWriter newWriter(File file)


newWriter

@Deprecatedreturn ResourceGroovyMethods.newReader(url, parameters);
public static BufferedWriter newWriter(File file, boolean append)


newWriter

@Deprecatedreturn ResourceGroovyMethods.newReader(url, charset);
public static BufferedWriter newWriter(File file, String charset, boolean append)


newWriter

@Deprecatedreturn ResourceGroovyMethods.newReader(url, parameters, charset);
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

@Deprecatedreturn StringGroovyMethods.replaceAll(self, pattern, replacement);
public static CharSequence next(CharSequence self)


next

@Deprecatedreturn StringGroovyMethods.replaceAll(self, regex, closure);
public static String next(String self)


normalize

@Deprecatedreturn StringGroovyMethods.replaceFirst(self, regex, replacement);
public static CharSequence normalize(CharSequence self)


normalize

@Deprecatedreturn StringGroovyMethods.replaceFirst(self, regex, closure);
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

@Deprecatedreturn StringGroovyMethods.replaceFirst(self, pattern, replacement);
public static CharSequence padLeft(CharSequence self, Number numberOfChars)


padLeft

@Deprecatedreturn StringGroovyMethods.replaceFirst(self, pattern, closure);
public static CharSequence padLeft(CharSequence self, Number numberOfChars, CharSequence padding)


padLeft

@Deprecatedreturn StringGroovyMethods.replaceFirst(self, pattern, closure);
public static String padLeft(String self, Number numberOfChars)


padLeft

@Deprecatedreturn StringGroovyMethods.replaceFirst(self, pattern, replacement);
public static String padLeft(String self, Number numberOfChars, String padding)


padRight

@Deprecatedreturn StringGroovyMethods.replaceFirst(self, regex, closure);
public static CharSequence padRight(CharSequence self, Number numberOfChars)


padRight

@Deprecatedreturn StringGroovyMethods.reverse(self);
public static CharSequence padRight(CharSequence self, Number numberOfChars, CharSequence padding)


padRight

@Deprecatedreturn StringGroovyMethods.reverse(self);
public static String padRight(String self, Number numberOfChars)


padRight

@DeprecatedStringGroovyMethods.setIndex(matcher, idx);
public static String padRight(String self, Number numberOfChars, String padding)


permutations

public static Set permutations(List self)


permutations

public static List permutations(List self, Closure function)
Iterates over all permutations of a collection, running a closure for each iteration.

Example usage:

def permutations = []
 [1, 2, 3].eachPermutation{ permutations << it }
 assert permutations == [[1, 2, 3], [1, 3, 2], [2, 1, 3], [2, 3, 1], [3, 1, 2], [3, 2, 1]]
Parameters:
self - the Collection of items
closure - the closure to call for each permutation
Returns:
the permutations from the list
Since:
1.7.0


plus

public static Map plus(Map left, Map right)
Support the subscript operator for Collection.
 assert [String, Long, Integer] == ["a",5L,2]["class"]
 
Parameters:
coll - a Collection
property - a String
Returns:
a List
Since:
1.0


plus

public static Map plus(Map self, Collection entries)


plus

@SuppressWarnings*/
public static Object[] plus(Object[] left, Object[] right)


plus

@SuppressWarnings* @param left  the array
public static Object[] plus(Object[] left, Object right)


plus

@SuppressWarnings* @param right the right Collection
public static Object[] plus(Object[] left, Collection right)


plus

@SuppressWarningspublic static  Collection plus(Collection left, Iterable right) {
public static Object[] plus(Object[] left, Iterable right)
Create a Collection as a union of a Collection and an Iterable. If the left collection is a Set, then the returned collection will be a Set otherwise a List. This operation will always create a new object for the result, while the operands remain unchanged.
Parameters:
left - the left Collection
right - the right Iterable
Returns:
the merged Collection
See Also:
plus(Collection, Collection)
Since:
1.8.7


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)
Create a List composed of the elements of this list, repeated a certain number of times. Note that for non-primitive elements, multiple references to the same instance will be added.
assert [1,2,3,1,2,3] == [1,2,3] * 2
Parameters:
self - a Collection
factor - the number of times to append
Returns:
the multiplied list
Since:
1.0


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)
Multiply a Character by a Number. The ordinal value of the Character is used in the multiplication (the ordinal value is the unicode value which for simple character sets is the ASCII value).
Parameters:
left - a Character
right - a Number
Returns:
the Number corresponding to the multiplication of left by right
Since:
1.0


plus

@Deprecatedreturn StringGroovyMethods.size(text);
public static CharSequence plus(CharSequence left, Object value)


plus

@Deprecatedreturn StringGroovyMethods.size(self);
public static String plus(Number value, String right)


plus

@Deprecatedreturn StringGroovyMethods.size(text);
public static String plus(String left, Object value)


plus

@Deprecatedreturn StringGroovyMethods.size(buffer);
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)


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

@Deprecatedreturn StringGroovyMethods.split(self);
public static CharSequence previous(CharSequence self)


previous

@Deprecatedreturn StringGroovyMethods.split(self);
public static String previous(String self)


primitiveArrayGet

protected static Object primitiveArrayGet(Object self, int idx)
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


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)


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)
A helper method to allow lists to work with subscript operators.
def list = ["a", true, 42, 9.4]
 list[1, 3] = 5
 assert list == ["a", 5, 42, 5]
Parameters:
self - a List
splice - 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, 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)


putAt

@Deprecatedreturn StringGroovyMethods.split(self);
public static void putAt(StringBuffer self, EmptyRange range, Object value)


putAt

@Deprecatedreturn StringGroovyMethods.splitEachLine(self, regex, closure);
public static void putAt(StringBuffer self, IntRange range, Object value)


readBytes

@Deprecated
public static byte[] readBytes(File file)


readLine

@Deprecatedreturn ResourceGroovyMethods.leftShift(file, text);
public static String readLine(Reader self)


readLines

@Deprecatedreturn StringGroovyMethods.splitEachLine(self, pattern, closure);
public static List readLines(CharSequence self)


readLines

@Deprecatedreturn StringGroovyMethods.splitEachLine(self, pattern, closure);
public static List readLines(String self)


readLines

@Deprecatedreturn ResourceGroovyMethods.leftShift(file, bytes);
public static List readLines(File file)


readLines

@Deprecatedreturn ResourceGroovyMethods.leftShift(file, data);
public static List readLines(File file, String charset)


readLines

@DeprecatedResourceGroovyMethods.write(file, text, charset);
public static List readLines(InputStream stream)


readLines

@DeprecatedResourceGroovyMethods.append(file, text);
public static List readLines(InputStream stream, String charset)


readLines

@DeprecatedResourceGroovyMethods.append(file, bytes);
public static List readLines(URL self)


readLines

@DeprecatedResourceGroovyMethods.append(self, stream);
public static List readLines(URL self, String charset)


readLines

@DeprecatedResourceGroovyMethods.append(file, text, charset);
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

@Deprecatedpublic static  T withWriterAppend(File file, Closure closure) throws IOException {
public static boolean renameTo(File self, String newPathName)


replaceAll

@Deprecatedreturn StringGroovyMethods.splitEachLine(self, regex, closure);
public static CharSequence replaceAll(CharSequence self, CharSequence regex, CharSequence replacement)


replaceAll

@Deprecatedreturn StringGroovyMethods.stripIndent(self);
public static CharSequence replaceAll(CharSequence self, CharSequence regex, Closure closure)


replaceAll

@Deprecatedreturn StringGroovyMethods.stripIndent(self, numChars);
public static CharSequence replaceAll(CharSequence self, Pattern pattern, CharSequence replacement)


replaceAll

@Deprecatedreturn StringGroovyMethods.stripIndent(self);
public static String replaceAll(CharSequence self, Pattern pattern, Closure closure)


replaceAll

@Deprecatedreturn StringGroovyMethods.stripIndent(self, numChars);
public static String replaceAll(String self, Pattern pattern, Closure closure)


replaceAll

@Deprecatedreturn StringGroovyMethods.stripMargin(self);
public static String replaceAll(String self, Pattern pattern, String replacement)


replaceAll

@Deprecatedreturn StringGroovyMethods.stripMargin(self, marginChar);
public static String replaceAll(String self, String regex, Closure closure)


replaceFirst

@Deprecatedreturn StringGroovyMethods.stripMargin(self, marginChar);
public static String replaceFirst(CharSequence self, CharSequence regex, CharSequence replacement)


replaceFirst

@Deprecatedreturn StringGroovyMethods.stripMargin(self);
public static String replaceFirst(CharSequence self, CharSequence regex, Closure closure)


replaceFirst

@Deprecatedreturn StringGroovyMethods.stripMargin(self, marginChar);
public static CharSequence replaceFirst(CharSequence self, Pattern pattern, CharSequence replacement)


replaceFirst

@Deprecatedreturn StringGroovyMethods.stripMargin(self, marginChar);
public static String replaceFirst(CharSequence self, Pattern pattern, Closure closure)


replaceFirst

@Deprecatedreturn StringGroovyMethods.toBigDecimal(self);
public static String replaceFirst(String self, Pattern pattern, Closure closure)


replaceFirst

@Deprecatedreturn StringGroovyMethods.toBigDecimal(self);
public static String replaceFirst(String self, Pattern pattern, String replacement)


replaceFirst

@Deprecatedreturn StringGroovyMethods.toBigInteger(self);
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)


reverse

@SuppressWarningsreturn new ReverseListIterator(toList(self));
public static Object[] reverse(Object[] self)
Reverses the iterator. The original iterator will become exhausted of elements after determining the reversed values. A new iterator for iterating through the reversed values is returned.
Parameters:
self - an Iterator
Returns:
a reversed Iterator
Since:
1.5.5


reverse

@SuppressWarnings* @since 1.8.7
public static Object[] reverse(Object[] self, boolean mutate)


reverse

public static Iterator reverse(Iterator self)
Create an array containing elements from an original array plus an additional appended element.
 Integer[] a = [1, 2, 3]
 Integer[] result = a + 4
 assert result == [1, 2, 3, 4] as Integer[]
 
Parameters:
left - the array
right - the value to append
Returns:
A new array containing left with right appended to it.
Since:
1.8.7


reverse

@Deprecatedreturn StringGroovyMethods.toBigInteger(self);
public static CharSequence reverse(CharSequence self)


reverse

@Deprecatedreturn StringGroovyMethods.toBoolean(self);
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)


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

@Deprecatedpublic static boolean deleteDir(final File self) {
public static void setBytes(File file, byte[] bytes)


setBytes

@Deprecatedpublic static boolean renameTo(final File self, String newPathName) {
public static void setBytes(OutputStream os, byte[] bytes)


setIndex

@Deprecatedreturn StringGroovyMethods.toCharacter(self);
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

@Deprecatedpublic static Iterator iterator(final DataInputStream self) {
public static void setText(File file, String text)


setText

@Deprecatedpublic static File asWritable(File file) {
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)


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)
Converts this array to a List of the same size, with each element added to the list.
Parameters:
array - a long array
Returns:
a list containing the contents of this array.
Since:
1.0


size

public static int size(long[] array)


size

public static int size(float[] array)


size

public static int size(double[] array)


size

@Deprecatedreturn StringGroovyMethods.toDouble(self);
public static int size(CharSequence text)


size

@Deprecatedreturn StringGroovyMethods.toDouble(self);
public static long size(Matcher self)


size

@Deprecatedreturn StringGroovyMethods.toFloat(self);
public static int size(String text)


size

@Deprecatedreturn StringGroovyMethods.toFloat(self);
public static int size(StringBuffer buffer)


size

@Deprecatedreturn IOGroovyMethods.eachLine(stream, closure);
public static long size(File self)


sort

@Deprecated/**
public static List sort(Collection self)


sort

public static List sort(Iterable self)


sort

@Deprecated* the closure as a comparator to determine the ordering.
public static List sort(Collection self, boolean mutate)


sort

public static List sort(Iterable self, boolean mutate)


sort

public static Map sort(Map self, Closure closure)


sort

public static Map sort(Map self, Comparator comparator)
Modifies this array so that its elements are in sorted order. The array items are assumed to be comparable.
Parameters:
self - the array to be sorted
Returns:
the sorted array
Since:
1.5.5


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 using the comparator. 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
comparator - a Comparator used for comparing items
Returns:
the sorted items as an Iterator
Since:
1.5.5


sort

public static Iterator sort(Iterator self)
deprecated:
Use the Iterable version of sort instead
See Also:
sort(Iterable, Comparator)
Since:
1.0


sort

public static Iterator sort(Iterator self, Comparator comparator)


sort

@Deprecatedpublic static  List sort(Collection self, boolean mutate, Comparator comparator) {
public static List sort(Collection self, Comparator comparator)
deprecated:
Use the Iterable version of sort instead
See Also:
sort(Iterable, boolean, Comparator)
Since:
1.8.1


sort

public static List sort(Iterable self, Comparator comparator)


sort

@Deprecated* Sorts the given array into sorted order using the given comparator.
public static List sort(Collection self, boolean mutate, Comparator comparator)


sort

public static List sort(Iterable self, boolean mutate, Comparator comparator)


sort

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


sort

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


sort

public static Iterator sort(Iterator self, Closure closure)


sort

@SuppressWarningsT[] answer = (T[]) sort(toList(self), closure).toArray();
public static Object[] sort(Object[] self, Closure closure)


sort

@SuppressWarningsreturn sort((Iterable)self, closure);
public static Object[] sort(Object[] self, boolean mutate, Closure closure)
Sorts this Collection using the given Closure to determine the correct ordering. 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.

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.

assert ["hi","hey","hello"] == ["hello","hi","hey"].sort { it.length() }
assert ["hi","hey","hello"] == ["hello","hi","hey"].sort { a, b -> a.length() <=> b.length() }
Parameters:
self - a Collection to be sorted
closure - a 1 or 2 arg Closure used to determine the correct ordering
Returns:
a newly created sorted List
See Also:
sort(Collection, boolean, Closure)
Since:
1.0


sort

public static List sort(Collection self, Closure closure)
Sorts this Iterable using the given Closure to determine the correct ordering. If the Iterable 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 Iterable unchanged.

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.

assert ["hi","hey","hello"] == ["hello","hi","hey"].sort { it.length() }
assert ["hi","hey","hello"] == ["hello","hi","hey"].sort { a, b -> a.length() <=> b.length() }
Parameters:
self - the Iterable to be sorted
closure - a 1 or 2 arg Closure used to determine the correct ordering
Returns:
a newly created sorted List
See Also:
sort(Collection, boolean, Closure)
Since:
2.2.0


sort

public static List sort(Iterable self, Closure closure)


sort

@Deprecated*/
public static List sort(Collection self, boolean mutate, Closure closure)


sort

public static List sort(Iterable 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)
Provides an easy way to append multiple Map.Entry values to a Map.
Parameters:
self - a Map
entries - a Collection of Map.Entry items to be added to the Map.
Returns:
the same map, after the items have been added to it.
Since:
1.6.1


split

public static Collection split(Object self, Closure closure)


split

public static Collection split(Collection self, Closure closure)


split

@Deprecatedreturn StringGroovyMethods.toInteger(self);
public static CharSequence[] split(CharSequence self)


split

@Deprecatedreturn StringGroovyMethods.toInteger(self);
public static String[] split(GString self)


split

@Deprecatedreturn StringGroovyMethods.tokenize(self);
public static String[] split(String self)


splitEachLine

@Deprecatedreturn StringGroovyMethods.tokenize(self, token);
public static Object splitEachLine(CharSequence self, CharSequence regex, Closure closure)


splitEachLine

@Deprecatedreturn StringGroovyMethods.tokenize(self, token);
public static Object splitEachLine(CharSequence self, Pattern pattern, Closure closure)


splitEachLine

@Deprecatedpublic static List tokenize(String self) {
public static Object splitEachLine(String self, Pattern pattern, Closure closure)


splitEachLine

@Deprecatedpublic static List tokenize(String self, Character token) {
public static Object splitEachLine(String self, String regex, Closure closure)


splitEachLine

@Deprecatedreturn ResourceGroovyMethods.getText(url, parameters, charset);
public static Object splitEachLine(File self, String regex, Closure closure)


splitEachLine

@Deprecatedreturn IOGroovyMethods.getText(is);
public static Object splitEachLine(File self, Pattern pattern, Closure closure)


splitEachLine

@Deprecatedreturn IOGroovyMethods.getText(is, charset);
public static Object splitEachLine(File self, String regex, String charset, Closure closure)


splitEachLine

@Deprecatedreturn IOGroovyMethods.getText(reader);
public static Object splitEachLine(File self, Pattern pattern, String charset, Closure closure)


splitEachLine

@Deprecatedreturn IOGroovyMethods.getText(reader);
public static Object splitEachLine(URL self, String regex, Closure closure)


splitEachLine

@Deprecatedreturn ResourceGroovyMethods.getBytes(file);
public static Object splitEachLine(URL self, Pattern pattern, Closure closure)


splitEachLine

@Deprecatedreturn ResourceGroovyMethods.getBytes(url);
public static Object splitEachLine(URL self, String regex, String charset, Closure closure)


splitEachLine

@Deprecatedreturn IOGroovyMethods.getBytes(is);
public static Object splitEachLine(URL self, Pattern pattern, String charset, Closure closure)


splitEachLine

@DeprecatedResourceGroovyMethods.setBytes(file, bytes);
public static Object splitEachLine(Reader self, String regex, Closure closure)


splitEachLine

@DeprecatedIOGroovyMethods.setBytes(os, bytes);
public static Object splitEachLine(Reader self, Pattern pattern, Closure closure)


splitEachLine

@DeprecatedIOGroovyMethods.writeLine(writer, line);
public static Object splitEachLine(InputStream stream, String regex, String charset, Closure closure)


splitEachLine

@DeprecatedResourceGroovyMethods.write(file, text);
public static Object splitEachLine(InputStream stream, Pattern pattern, String charset, Closure closure)


splitEachLine

@DeprecatedResourceGroovyMethods.setText(file, text);
public static Object splitEachLine(InputStream stream, String regex, Closure closure)


splitEachLine

@DeprecatedResourceGroovyMethods.setText(file, text, charset);
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@SuppressWarnings("unchecked")
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

@Deprecated* @see #sum(java.util.Collection)
public static Object sum(Collection self)


sum

public static Object sum(Iterable self)


sum

public static Object sum(Object[] self)
deprecated:
Use the Iterable version of sum instead
See Also:
sum(Iterable, Object)
Since:
1.5.0


sum

public static Object sum(Iterator self)


sum

@Deprecated* @param initialValue the items in the array will be summed to this initial value
public static Object sum(Collection self, Object initialValue)


sum

public static Object sum(Iterable self, Object initialValue)


sum

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


sum

public static Object sum(Iterator self, Object initialValue)


sum

@Deprecated* array.collect(closure).sum().
public static Object sum(Collection self, Closure closure)
Sums the result of apply a closure to each item of an Iterable. coll.sum(closure) is equivalent to: coll.collect(closure).sum().
assert 4+6+10+12 == [2,3,5,6].sum() { it * 2 }
Parameters:
self - an Iterable
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 Iterable.
Since:
2.2.0


sum

public static Object sum(Iterable self, Closure closure)


sum

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


sum

public static Object sum(Iterator self, Closure closure)


sum

@Deprecated* array.sum(initVal, closure) is equivalent to:
public static Object sum(Collection self, Object initialValue, Closure closure)


sum

public static Object sum(Iterable 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)


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)
Returns an iterator of up to the first num elements from this iterator. The original iterator is stepped along by num elements.
 def a = 0
 def iter = [ hasNext:{ true }, next:{ a++ } ] as Iterator
 def iteratorCompare( Iterator a, List b ) {
     a.collect { it } == b
 }
 assert iteratorCompare( iter.take( 0 ), [] )
 assert iteratorCompare( iter.take( 2 ), [ 0, 1 ] )
 assert iteratorCompare( iter.take( 5 ), [ 2, 3, 4, 5, 6 ] )
 
Parameters:
self - the Iterator
num - the number of elements to take from this iterator
Returns:
an iterator consisting of up to the first num elements of this iterator.
Since:
1.8.1


take

@SuppressWarnings
public static Iterator take(Iterator self, int num)


take

@DeprecatedList ret = createSimilarList(self, self.size() - num);
public static CharSequence take(CharSequence self, int num)


takeWhile

public static List takeWhile(List self, Closure condition)
Returns a List containing the longest prefix of the elements from this Iterable where each element passed to the given closure evaluates to true.
 class AbcIterable implements Iterable {
     Iterator iterator() { "abc".iterator() }
 }
 def abc = new AbcIterable()
 assert abc.takeWhile{ it < 'b' } == ['a']
 assert abc.takeWhile{ it <= 'b' } == ['a', 'b']
 
Parameters:
self - an Iterable
condition - the closure that must evaluate to true to continue taking elements
Returns:
a List containing a prefix of the elements from the given Iterable where each element passed to the given closure evaluates to true
Since:
1.8.7


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)


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* Converts this array to a Set, with each unique element
public static List toList(byte[] array)


toList

@SuppressWarnings* Converts this array to a Set, with each unique element
public static List toList(boolean[] array)


toList

@SuppressWarnings* Converts this array to a Set, with each unique element
public static List toList(char[] array)


toList

@SuppressWarnings* Converts this array to a Set, with each unique element
public static List toList(short[] array)


toList

@SuppressWarnings* Converts this array to a Set, with each unique element
public static List toList(int[] array)


toList

@SuppressWarnings* Converts this array to a Set, with each unique element
public static List toList(long[] array)


toList

@SuppressWarnings* Converts this array to a Set, with each unique element
public static List toList(float[] array)


toList

@SuppressWarnings* Convert a Collection to a Set. Always returns a new Set
public static List toList(double[] array)


toList

@Deprecatedreturn ProcessGroovyMethods.execute(commands, envp, dir);
public static List toList(CharSequence self)


toList

@Deprecatedreturn ProcessGroovyMethods.execute(commands, envp, dir);
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

@Deprecatedreturn SocketGroovyMethods.withStreams(socket, closure);
public static Long toLong(CharSequence self)


toLong

@Deprecatedreturn SocketGroovyMethods.withObjectStreams(socket, closure);
public static Long toLong(String self)


toLowerCase

public static char toLowerCase(Character self)


toMapString

public static String toMapString(Map self)


toMapString

public static String toMapString(Map self, int maxSize)


toSet

@SuppressWarnings*/
public static Set toSet(byte[] array)


toSet

@SuppressWarnings* @since 1.8.0
public static Set toSet(boolean[] array)


toSet

@SuppressWarnings* @param self an enumeration
public static Set toSet(char[] array)


toSet

@SuppressWarnings* Implements the getAt(int) method for primitive type arrays.
public static Set toSet(short[] array)


toSet

@SuppressWarnings*
public static Set toSet(int[] array)


toSet

@SuppressWarnings}
public static Set toSet(long[] array)


toSet

@SuppressWarningsList answer = new ArrayList();
public static Set toSet(float[] array)
Implements the getAt(Collection) method for primitive type arrays. Each value in the collection argument is assumed to be a valid array index. The value at each index is then added to a list which is returned.
Parameters:
self - an array object
indices - the indices of interest
Returns:
the returned values from the array
Since:
1.0


toSet

@SuppressWarnings
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)
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


toSet

public static Set toSet(Enumeration self)
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


toSet

@Deprecatedreturn SocketGroovyMethods.leftShift(self, value);
public static Set toSet(CharSequence self)


toSet

@Deprecatedreturn SocketGroovyMethods.leftShift(self, value);
public static Set toSet(String self)


toShort

@Deprecatedreturn SocketGroovyMethods.accept(serverSocket, closure);
public static Short toShort(CharSequence self)


toShort

@Deprecatedfinal Closure closure) throws IOException {
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)
Decrement a Number by one.
Parameters:
self - a Number
Returns:
a decremented Number
Since:
1.0


toString

public static String toString(Object[] self)


toString

public static String toString(Object value)
Compare a Character and a Number. 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 Character
right - a Number
Returns:
the result of the comparison
Since:
1.0


toURI

@Deprecatedpublic static long size(File self) {
public static URI toURI(CharSequence self)


toURI

@Deprecatedpublic static Writer leftShift(Writer self, Object value) throws IOException {
public static URI toURI(String self)


toURL

@Deprecatedpublic static void write(Writer self, Writable writable) throws IOException {
public static URL toURL(CharSequence self)


toURL

@Deprecatedpublic static Writer leftShift(OutputStream self, Object value) throws IOException {
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
@SuppressWarningspublic static Process execute(final String[] commandArray, final String[] envp, final File dir) throws IOException {
public static List tokenize(String self)


tokenize

@Deprecatedpublic static Process execute(final String[] commandArray, final List envp, final File dir) throws IOException {
public static List tokenize(String self, Character token)


tokenize

@Deprecatedpublic static Process execute(final List commands) throws IOException {
@SuppressWarningsreturn ProcessGroovyMethods.execute(commands);
public static List tokenize(String self, String token)


tr

@Deprecatedpublic static void leftShift(ObjectOutputStream self, Object value) throws IOException {
public static CharSequence tr(CharSequence self, CharSequence sourceSet, CharSequence replacementSet)


tr

@Deprecatedpublic static OutputStream leftShift(OutputStream self, InputStream in) throws IOException {
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

@Deprecatedreturn ResourceGroovyMethods.withInputStream(url, closure);
public static void traverse(File self, Map options, Closure closure)


traverse

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


traverse

@Deprecated}
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)
Iterates from this number up to the given number, inclusive, incrementing by one each time.
Parameters:
self - a float
to - the end number
closure - the code to execute for each number
Since:
1.0


unaryPlus

public static Number unaryPlus(Number left)


unexpand

@Deprecatedpublic static OutputStream leftShift(OutputStream self, byte[] value) throws IOException {
public static CharSequence unexpand(CharSequence self)


unexpand

@Deprecatedpublic static ObjectOutputStream newObjectOutputStream(File file) throws IOException {
public static CharSequence unexpand(CharSequence self, int tabStop)


unexpand

@Deprecatedpublic static ObjectOutputStream newObjectOutputStream(OutputStream outputStream) throws IOException {
public static String unexpand(String self)


unexpand

@Deprecatedpublic static  T withObjectOutputStream(File file, Closure closure) throws IOException {
public static String unexpand(String self, int tabStop)


unexpandLine

@Deprecatedpublic static  T withObjectOutputStream(OutputStream outputStream, Closure closure) throws IOException {
public static CharSequence unexpandLine(CharSequence self, int tabStop)


unexpandLine

@Deprecatedpublic static ObjectInputStream newObjectInputStream(File file) throws IOException {
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)
Iterates from this number up to the given number, inclusive, incrementing by one each time.
Parameters:
self - a Double
to - the end number
closure - the code to execute for each number
Since:
1.0


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)


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

@Deprecatedreturn ResourceGroovyMethods.newInputStream(url, parameters);
public static Object withDataInputStream(File file, Closure closure)


withDataOutputStream

@Deprecatedreturn ResourceGroovyMethods.newInputStream(url);
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)
deprecated:
Use the Iterable version of sort instead
See Also:
sort(Iterable)
Since:
1.0


withInputStream

@Deprecatedreturn IOGroovyMethods.withStream(os, closure);
public static Object withInputStream(File file, Closure closure)


withInputStream

@Deprecatedreturn ResourceGroovyMethods.newInputStream(file);
public static Object withInputStream(URL url, Closure closure)


withLazyDefault

public static List withLazyDefault(List self, Closure init)


withObjectInputStream

@Deprecatedreturn IOGroovyMethods.splitEachLine(self, pattern, closure);
public static Object withObjectInputStream(File file, Closure closure)


withObjectInputStream

@Deprecatedreturn IOGroovyMethods.splitEachLine(stream, charset, regex, closure);
public static Object withObjectInputStream(File file, ClassLoader classLoader, Closure closure)


withObjectInputStream

@Deprecatedreturn IOGroovyMethods.splitEachLine(stream, pattern, charset, closure);
public static Object withObjectInputStream(InputStream inputStream, Closure closure)


withObjectInputStream

@Deprecatedreturn IOGroovyMethods.splitEachLine(stream, regex, closure);
public static Object withObjectInputStream(InputStream inputStream, ClassLoader classLoader, Closure closure)


withObjectOutputStream

@Deprecatedreturn ResourceGroovyMethods.splitEachLine(self, pattern, closure);
public static Object withObjectOutputStream(File file, Closure closure)


withObjectOutputStream

@Deprecatedreturn ResourceGroovyMethods.splitEachLine(self, regex, charset, closure);
public static Object withObjectOutputStream(OutputStream outputStream, Closure closure)


withObjectStreams

@Deprecatedpublic static  T eachLine(File self, String charset, Closure closure) throws IOException {
public static Object withObjectStreams(Socket socket, Closure closure)


withOutputStream

@Deprecatedreturn IOGroovyMethods.withWriter(stream, charset, closure);
public static Object withOutputStream(File file, Closure closure)


withPrintWriter

@DeprecatedIOGroovyMethods.transformChar(self, writer, closure);
public static Object withPrintWriter(File file, Closure closure)


withPrintWriter

@DeprecatedIOGroovyMethods.transformLine(reader, writer, closure);
public static Object withPrintWriter(File file, String charset, Closure closure)


withPrintWriter

@DeprecatedIOGroovyMethods.filterLine(reader, writer, closure);
public static Object withPrintWriter(Writer writer, Closure closure)


withReader

@Deprecatedreturn ResourceGroovyMethods.withReader(url, charset, closure);
public static Object withReader(File file, Closure closure)


withReader

@Deprecatedreturn IOGroovyMethods.withReader(in, closure);
public static Object withReader(File file, String charset, Closure closure)


withReader

@Deprecatedreturn ResourceGroovyMethods.filterLine(self, closure);
public static Object withReader(Reader reader, Closure closure)


withReader

@DeprecatedResourceGroovyMethods.filterLine(self, writer, charset, closure);
public static Object withReader(URL url, Closure closure)


withReader

@Deprecatedreturn IOGroovyMethods.filterLine(reader, closure);
public static Object withReader(URL url, String charset, Closure closure)


withReader

@Deprecatedreturn IOGroovyMethods.filterLine(self, predicate);
public static Object withReader(InputStream in, Closure closure)


withReader

@Deprecatedreturn IOGroovyMethods.filterLine(self, charset, predicate);
public static Object withReader(InputStream in, String charset, Closure closure)


withStream

@DeprecatedResourceGroovyMethods.filterLine(self, writer, closure);
public static Object withStream(InputStream stream, Closure closure)


withStream

@Deprecatedreturn ResourceGroovyMethods.filterLine(self, predicate);
public static Object withStream(OutputStream os, Closure closure)


withStreams

@Deprecatedpublic static  T eachLine(File self, Closure closure) throws IOException {
public static Object withStreams(Socket socket, Closure closure)


withWriter

@Deprecatedreturn ResourceGroovyMethods.newDataInputStream(file);
public static Object withWriter(File file, Closure closure)


withWriter

@DeprecatedResourceGroovyMethods.eachByte(self, closure);
public static Object withWriter(File file, String charset, Closure closure)


withWriter

@Deprecatedreturn ResourceGroovyMethods.filterLine(self, closure);
public static Object withWriter(Writer writer, Closure closure)


withWriter

@DeprecatedIOGroovyMethods.filterLine(self, writer, predicate);
public static Object withWriter(OutputStream stream, Closure closure)


withWriter

@DeprecatedIOGroovyMethods.filterLine(self, writer, charset, predicate);
public static Object withWriter(OutputStream stream, String charset, Closure closure)


withWriterAppend

@DeprecatedResourceGroovyMethods.eachByte(self, bufferLen, closure);
public static Object withWriterAppend(File file, String charset, Closure closure)


withWriterAppend

@DeprecatedIOGroovyMethods.eachByte(is, closure);
public static Object withWriterAppend(File file, Closure closure)


write

@Deprecatedreturn ResourceGroovyMethods.eachLine(url, closure);
public static void write(Writer self, Writable writable)


write

@Deprecatedpublic static Iterator iterator(InputStream self) {
public static void write(File file, String text)


write

@Deprecatedpublic static BufferedReader newReader(File file, String charset)
public static void write(File file, String text, String charset)


writeLine

@Deprecatedpublic static Iterator iterator(Reader self) {
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.