|
Groovy Documentation | |||||||
FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.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.
Field Summary | |
---|---|
static java.lang.Class[] |
DGM_LIKE_CLASSES
|
static java.lang.Class[] |
additionals
|
Method Summary | |
---|---|
static int
|
abs(java.lang.Number number)
Truncate the value |
static long
|
abs(java.lang.Long number)
|
static float
|
abs(java.lang.Float number)
|
static double
|
abs(java.lang.Double number)
Determine if a Character is lowercase. |
static java.net.Socket
|
accept(java.net.ServerSocket serverSocket, Closure closure)
|
static java.net.Socket
|
accept(java.net.ServerSocket serverSocket, boolean runInANewThread, Closure closure)
|
static boolean
|
addAll(java.util.Collection self, java.lang.Object[] items)
|
static boolean
|
addAll(java.util.List self, int index, java.lang.Object[] items)
Splits all items into two lists based on the closure condition. |
static void
|
addShutdownHook(java.lang.Object self, Closure closure)
|
static java.lang.Number
|
and(java.lang.Number left, java.lang.Number right)
|
static java.util.BitSet
|
and(java.util.BitSet left, java.util.BitSet right)
|
static java.lang.Boolean
|
and(java.lang.Boolean left, java.lang.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(java.lang.Object self, Closure closure)
|
static boolean
|
any(java.util.Map self, Closure closure)
|
static boolean
|
any(java.lang.Object self)
|
static void
|
append(java.io.File file, java.lang.Object text)
|
static void
|
append(java.io.File file, byte[] bytes)
|
static void
|
append(java.io.File self, java.io.InputStream stream)
|
static void
|
append(java.io.File file, java.lang.Object text, java.lang.String charset)
|
static boolean
|
asBoolean(java.lang.Object object)
|
static boolean
|
asBoolean(java.lang.Boolean bool)
|
static boolean
|
asBoolean(java.util.Collection collection)
|
static boolean
|
asBoolean(java.util.Map map)
|
static boolean
|
asBoolean(java.util.Iterator iterator)
|
static boolean
|
asBoolean(java.util.Enumeration enumeration)
|
static boolean
|
asBoolean(java.lang.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(java.lang.Character character)
|
static boolean
|
asBoolean(java.lang.Number number)
|
static boolean
|
asBoolean(java.lang.CharSequence string)
|
static boolean
|
asBoolean(java.util.regex.Matcher matcher)
|
static java.util.Map
|
asImmutable(java.util.Map self)
A convenience method for creating an immutable list |
static java.util.SortedMap
|
asImmutable(java.util.SortedMap self)
|
static java.util.List
|
asImmutable(java.util.List self)
|
static java.util.Set
|
asImmutable(java.util.Set self)
|
static java.util.SortedSet
|
asImmutable(java.util.SortedSet self)
|
static java.util.Collection
|
asImmutable(java.util.Collection self)
A convenience method for creating a synchronized SortedMap. |
static java.util.List
|
asList(java.util.Collection self)
|
static java.util.List
|
asList(java.lang.Iterable self)
Coerce an Boolean instance to a boolean value. |
static java.util.Map
|
asSynchronized(java.util.Map self)
|
static java.util.SortedMap
|
asSynchronized(java.util.SortedMap self)
|
static java.util.Collection
|
asSynchronized(java.util.Collection self)
|
static java.util.List
|
asSynchronized(java.util.List self)
|
static java.util.Set
|
asSynchronized(java.util.Set self)
|
static java.util.SortedSet
|
asSynchronized(java.util.SortedSet self)
|
static java.lang.Object
|
asType(java.util.Collection col, java.lang.Class clazz)
|
static java.lang.Object
|
asType(java.lang.Object[] ary, java.lang.Class clazz)
Converts the given array to either a List, Set, or SortedSet. |
static java.lang.Object
|
asType(Closure cl, java.lang.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 java.lang.Object
|
asType(java.util.Map map, java.lang.Class clazz)
Creates a new List with the identical contents to this list but in reverse order. |
static java.lang.Object
|
asType(java.lang.Number self, java.lang.Class c)
Traverse through each byte of this Byte array. |
static java.lang.Object
|
asType(java.lang.Object obj, java.lang.Class type)
Adds a "metaClass" property to all class objects so you can use the syntax
|
static java.lang.Object
|
asType(java.lang.CharSequence self, java.lang.Class c)
|
static java.lang.Object
|
asType(GString self, java.lang.Class c)
|
static java.lang.Object
|
asType(java.lang.String self, java.lang.Class c)
|
static java.lang.Object
|
asType(java.io.File f, java.lang.Class c)
|
static java.io.File
|
asWritable(java.io.File file)
|
static java.io.File
|
asWritable(java.io.File file, java.lang.String encoding)
|
static java.util.BitSet
|
bitwiseNegate(java.util.BitSet self)
Iterates from this number up to the given number, inclusive, incrementing by one each time. |
static java.util.regex.Pattern
|
bitwiseNegate(java.lang.CharSequence self)
|
static java.util.regex.Pattern
|
bitwiseNegate(java.lang.String self)
|
protected static java.lang.Object
|
callClosureForLine(Closure closure, java.lang.String line, int counter)
|
protected static java.lang.Object
|
callClosureForMapEntry(Closure closure, java.util.Map$Entry entry)
|
protected static java.lang.Object
|
callClosureForMapEntryAndCounter(Closure closure, java.util.Map$Entry entry, int counter)
|
static java.lang.CharSequence
|
capitalize(java.lang.CharSequence self)
|
static java.lang.String
|
capitalize(java.lang.String self)
|
static java.lang.CharSequence
|
center(java.lang.CharSequence self, java.lang.Number numberOfChars)
|
static java.lang.CharSequence
|
center(java.lang.CharSequence self, java.lang.Number numberOfChars, java.lang.CharSequence padding)
|
static java.lang.String
|
center(java.lang.String self, java.lang.Number numberOfChars)
|
static java.lang.String
|
center(java.lang.String self, java.lang.Number numberOfChars, java.lang.String padding)
|
static java.util.List
|
collate(java.util.List self, int size)
|
static java.util.List
|
collate(java.util.List self, int size, int step)
|
static java.util.List
|
collate(java.util.List self, int size, boolean keepRemainder)
|
static java.util.List
|
collate(java.util.List self, int size, int step, boolean keepRemainder)
|
static java.util.List
|
collect(java.lang.Object self, Closure transform)
Iterates through this aggregate Object transforming each item into a new value using the
|
static java.util.Collection
|
collect(java.lang.Object self)
Iterates through this aggregate Object transforming each item into a new value using the |
static java.util.Collection
|
collect(java.lang.Object self, java.util.Collection collector, Closure transform)
|
static java.util.List
|
collect(java.util.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 java.util.List
|
collect(java.util.Collection self)
Iterates through this collection transforming each value into a new value using the |
static java.util.Collection
|
collect(java.util.Collection self, java.util.Collection collector, Closure transform)
|
static java.util.Collection
|
collect(java.util.Map self, java.util.Collection collector, Closure transform)
|
static java.util.List
|
collect(java.util.Map self, Closure transform)
|
static java.util.List
|
collectAll(java.util.Collection self, Closure transform)
|
static java.util.Collection
|
collectAll(java.util.Collection self, java.util.Collection collector, Closure transform)
|
static java.util.Map
|
collectEntries(java.util.Map self, java.util.Map collector, Closure transform)
|
static java.util.Map
|
collectEntries(java.util.Map self, Closure transform)
@deprecated Use the Iterable version of collectEntries instead |
static java.util.Map
|
collectEntries(java.util.Collection self, Closure transform)
|
static java.util.Map
|
collectEntries(java.util.Iterator self, Closure transform)
|
static java.util.Map
|
collectEntries(java.lang.Iterable self, Closure transform)
@deprecated Use the Iterable version of collectEntries instead |
static java.util.Map
|
collectEntries(java.util.Collection self)
|
static java.util.Map
|
collectEntries(java.util.Iterator self)
|
static java.util.Map
|
collectEntries(java.lang.Iterable self)
@deprecated Use the Iterable version of collectEntries instead |
static java.util.Map
|
collectEntries(java.util.Collection self, java.util.Map collector, Closure transform)
|
static java.util.Map
|
collectEntries(java.util.Iterator self, java.util.Map collector, Closure transform)
|
static java.util.Map
|
collectEntries(java.lang.Iterable self, java.util.Map collector, Closure transform)
@deprecated Use the Iterable version of collectEntries instead |
static java.util.Map
|
collectEntries(java.util.Collection self, java.util.Map collector)
|
static java.util.Map
|
collectEntries(java.util.Iterator self, java.util.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 java.util.Map
|
collectEntries(java.lang.Iterable self, java.util.Map collector)
|
static java.util.Map
|
collectEntries(java.lang.Object[] self, java.util.Map collector, Closure transform)
A variant of collectEntries using the identity closure as the transform. |
static java.util.Map
|
collectEntries(java.lang.Object[] self, java.util.Map collector)
|
static java.util.Map
|
collectEntries(java.lang.Object[] self, Closure transform)
A variant of collectEntries using the identity closure as the transform. |
static java.util.Map
|
collectEntries(java.lang.Object[] self)
|
static java.util.List
|
collectMany(java.util.Collection self, Closure projection)
@deprecated Use the Iterable version of collectMany instead |
static java.util.Collection
|
collectMany(java.util.Collection self, java.util.Collection collector, Closure projection)
|
static java.util.List
|
collectMany(java.lang.Iterable self, Closure projection)
|
static java.util.Collection
|
collectMany(java.lang.Iterable self, java.util.Collection collector, Closure projection)
|
static java.util.Collection
|
collectMany(java.util.Map self, java.util.Collection collector, Closure projection)
|
static java.util.Collection
|
collectMany(java.util.Map self, Closure projection)
|
static java.util.List
|
collectMany(java.lang.Object[] self, Closure projection)
|
static java.util.List
|
collectMany(java.util.Iterator self, Closure projection)
|
static java.util.List
|
collectNested(java.util.Collection self, Closure transform)
|
static java.util.List
|
collectNested(java.lang.Iterable self, Closure transform)
Deprecated alias for collectNested |
static java.util.Collection
|
collectNested(java.util.Collection self, java.util.Collection collector, Closure transform)
|
static java.util.Collection
|
collectNested(java.lang.Iterable self, java.util.Collection collector, Closure transform)
|
static java.util.List
|
combinations(java.util.Collection self)
Adds GroovyCollections#combinations(Iterable) as a method on Iterables. |
static java.util.List
|
combinations(java.lang.Iterable self)
Adds GroovyCollections#combinations(Iterable, Closure) as a method on collections. |
static java.util.List
|
combinations(java.lang.Iterable self, Closure function)
Applies a function on each combination of the input lists. |
static int
|
compareTo(java.lang.Character left, java.lang.Number right)
Multiply a Number by a Character. |
static int
|
compareTo(java.lang.Number left, java.lang.Character right)
Multiply two Characters. |
static int
|
compareTo(java.lang.Character left, java.lang.Character right)
|
static int
|
compareTo(java.lang.Number left, java.lang.Number right)
|
static boolean
|
contains(int[] self, java.lang.Object value)
|
static boolean
|
contains(long[] self, java.lang.Object value)
Checks whether the array contains the given value. |
static boolean
|
contains(short[] self, java.lang.Object value)
Returns the string representation of the given array. |
static boolean
|
contains(char[] self, java.lang.Object value)
Returns the string representation of the given array. |
static boolean
|
contains(boolean[] self, java.lang.Object value)
Returns the string representation of the given array. |
static boolean
|
contains(double[] self, java.lang.Object value)
Returns the string representation of the given array. |
static boolean
|
contains(float[] self, java.lang.Object value)
Returns the string representation of the given array. |
static boolean
|
contains(byte[] self, java.lang.Object value)
Returns the string representation of the given array. |
static boolean
|
contains(java.lang.Object[] self, java.lang.Object value)
|
static boolean
|
contains(java.lang.CharSequence self, java.lang.CharSequence text)
|
static boolean
|
contains(java.lang.String self, java.lang.String text)
|
static boolean
|
containsAll(java.util.Collection self, java.lang.Object[] items)
Modifies this collection by removing its elements that are contained within the specified object array. |
static java.lang.Number
|
count(java.util.Iterator self, java.lang.Object value)
|
static java.lang.Number
|
count(java.util.Iterator self, Closure closure)
Counts the number of occurrences which satisfy the given closure from the items within this Iterator. |
static java.lang.Number
|
count(java.util.Collection self, java.lang.Object value)
@deprecated use count(Iterable, Closure) |
static java.lang.Number
|
count(java.lang.Iterable self, java.lang.Object value)
@deprecated use count(Iterable, Closure) |
static java.lang.Number
|
count(java.util.Collection self, Closure closure)
|
static java.lang.Number
|
count(java.lang.Iterable self, Closure closure)
|
static java.lang.Number
|
count(java.util.Map self, Closure closure)
|
static java.lang.Number
|
count(java.lang.Object[] self, java.lang.Object value)
Counts the number of occurrences of the given value inside this array. |
static java.lang.Number
|
count(java.lang.Object[] self, Closure closure)
Counts the number of occurrences of the given value inside this array. |
static java.lang.Number
|
count(int[] self, java.lang.Object value)
Counts the number of occurrences of the given value inside this array. |
static java.lang.Number
|
count(long[] self, java.lang.Object value)
Counts the number of occurrences of the given value inside this array. |
static java.lang.Number
|
count(short[] self, java.lang.Object value)
Counts the number of occurrences of the given value inside this array. |
static java.lang.Number
|
count(char[] self, java.lang.Object value)
Counts the number of occurrences of the given value inside this array. |
static java.lang.Number
|
count(boolean[] self, java.lang.Object value)
Counts the number of occurrences of the given value inside this array. |
static java.lang.Number
|
count(double[] self, java.lang.Object value)
Counts the number of occurrences of the given value inside this array. |
static java.lang.Number
|
count(float[] self, java.lang.Object value)
Counts the number of occurrences of the given value inside this array. |
static java.lang.Number
|
count(byte[] self, java.lang.Object value)
|
static int
|
count(java.lang.CharSequence self, java.lang.CharSequence text)
|
static int
|
count(java.lang.String self, java.lang.String text)
|
static java.util.Map
|
countBy(java.util.Collection self, Closure closure)
|
static java.util.Map
|
countBy(java.lang.Iterable self, Closure closure)
Sorts all array members into groups determined by the supplied mapping closure and counts the group size. |
static java.util.Map
|
countBy(java.lang.Object[] self, Closure closure)
Sorts all iterator items into groups determined by the supplied mapping closure and counts the group size. |
static java.util.Map
|
countBy(java.util.Iterator self, Closure closure)
|
static java.util.Map
|
countBy(java.util.Map self, Closure closure)
Groups the current element according to the value |
protected static StringBufferWriter
|
createStringBufferWriter(java.lang.StringBuffer self)
|
protected static java.io.StringWriter
|
createStringWriter(java.lang.String self)
|
static boolean
|
deleteDir(java.io.File self)
|
static java.lang.CharSequence
|
denormalize(java.lang.CharSequence self)
|
static java.lang.String
|
denormalize(java.lang.String self)
|
static boolean
|
disjoint(java.util.Collection left, java.util.Collection right)
Compare the contents of this array to the contents of the given array. |
static java.lang.Number
|
div(java.lang.Character left, java.lang.Number right)
Bitwise AND together two Numbers. |
static java.lang.Number
|
div(java.lang.Number left, java.lang.Character right)
|
static java.lang.Number
|
div(java.lang.Character left, java.lang.Character right)
|
static void
|
downto(java.lang.Number self, java.lang.Number to, Closure closure)
Iterates from this number down to the given number, inclusive, decrementing by one each time. |
static void
|
downto(long self, java.lang.Number to, Closure closure)
Iterates from this number down to the given number, inclusive, decrementing by one each time. |
static void
|
downto(java.lang.Long self, java.lang.Number to, Closure closure)
|
static void
|
downto(float self, java.lang.Number to, Closure closure)
|
static void
|
downto(java.lang.Float self, java.lang.Number to, Closure closure)
|
static void
|
downto(double self, java.lang.Number to, Closure closure)
|
static void
|
downto(java.lang.Double self, java.lang.Number to, Closure closure)
|
static void
|
downto(java.math.BigInteger self, java.lang.Number to, Closure closure)
|
static void
|
downto(java.math.BigDecimal self, java.lang.Number to, Closure closure)
Get the absolute value |
static java.util.List
|
drop(java.util.List self, int num)
Drops the given number of elements from the head of this Iterable. |
static java.util.List
|
drop(java.lang.Iterable self, int num)
Drops the given number of elements from the head of this array if they are available. |
static java.lang.Object[]
|
drop(java.lang.Object[] self, int num)
Drops the given number of key/value pairs from the head of this map if they are available. |
static java.util.Map
|
drop(java.util.Map self, int num)
|
static java.util.Iterator
|
drop(java.util.Iterator self, int num)
Returns the longest prefix of this list where each element passed to the given closure condition evaluates to true. |
static java.lang.CharSequence
|
drop(java.lang.CharSequence self, int num)
|
static java.util.List
|
dropWhile(java.util.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 java.util.List
|
dropWhile(java.lang.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 java.util.Map
|
dropWhile(java.util.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 java.lang.Object[]
|
dropWhile(java.lang.Object[] self, Closure condition)
Creates an Iterator that returns a suffix of the elements from an original Iterator. |
static java.util.Iterator
|
dropWhile(java.util.Iterator self, Closure condition)
|
static java.lang.String
|
dump(java.lang.Object self)
|
static java.lang.Object
|
each(java.lang.Object self, Closure closure)
Iterates through an aggregate type or data structure, passing each item to the given closure. |
static java.util.Map
|
each(java.util.Map self, Closure closure)
|
static void
|
eachByte(java.lang.Byte[] self, Closure closure)
|
static void
|
eachByte(byte[] self, Closure closure)
|
static void
|
eachByte(java.io.File self, Closure closure)
|
static void
|
eachByte(java.io.File self, int bufferLen, Closure closure)
|
static void
|
eachByte(java.io.InputStream is, Closure closure)
|
static void
|
eachByte(java.io.InputStream is, int bufferLen, Closure closure)
|
static void
|
eachByte(java.net.URL url, Closure closure)
|
static void
|
eachByte(java.net.URL url, int bufferLen, Closure closure)
|
static void
|
eachCombination(java.lang.Iterable self, Closure function)
Finds all non-null subsequences of a list. |
static void
|
eachDir(java.io.File self, Closure closure)
|
static void
|
eachDirMatch(java.io.File self, java.lang.Object nameFilter, Closure closure)
|
static void
|
eachDirRecurse(java.io.File self, Closure closure)
|
static void
|
eachFile(java.io.File self, FileType fileType, Closure closure)
|
static void
|
eachFile(java.io.File self, Closure closure)
|
static void
|
eachFileMatch(java.io.File self, FileType fileType, java.lang.Object nameFilter, Closure closure)
|
static void
|
eachFileMatch(java.io.File self, java.lang.Object nameFilter, Closure closure)
|
static void
|
eachFileRecurse(java.io.File self, FileType fileType, Closure closure)
|
static void
|
eachFileRecurse(java.io.File self, Closure closure)
|
static java.lang.Object
|
eachLine(java.lang.CharSequence self, Closure closure)
|
static java.lang.Object
|
eachLine(java.lang.CharSequence self, int firstLine, Closure closure)
|
static java.lang.Object
|
eachLine(java.lang.String self, Closure closure)
|
static java.lang.Object
|
eachLine(java.lang.String self, int firstLine, Closure closure)
|
static java.lang.Object
|
eachLine(java.io.File self, Closure closure)
|
static java.lang.Object
|
eachLine(java.io.File self, java.lang.String charset, Closure closure)
|
static java.lang.Object
|
eachLine(java.io.File self, int firstLine, Closure closure)
|
static java.lang.Object
|
eachLine(java.io.File self, java.lang.String charset, int firstLine, Closure closure)
|
static java.lang.Object
|
eachLine(java.io.InputStream stream, java.lang.String charset, Closure closure)
|
static java.lang.Object
|
eachLine(java.io.InputStream stream, java.lang.String charset, int firstLine, Closure closure)
|
static java.lang.Object
|
eachLine(java.io.InputStream stream, Closure closure)
|
static java.lang.Object
|
eachLine(java.io.InputStream stream, int firstLine, Closure closure)
|
static java.lang.Object
|
eachLine(java.net.URL url, Closure closure)
|
static java.lang.Object
|
eachLine(java.net.URL url, int firstLine, Closure closure)
|
static java.lang.Object
|
eachLine(java.net.URL url, java.lang.String charset, Closure closure)
|
static java.lang.Object
|
eachLine(java.net.URL url, java.lang.String charset, int firstLine, Closure closure)
|
static java.lang.Object
|
eachLine(java.io.Reader self, Closure closure)
|
static java.lang.Object
|
eachLine(java.io.Reader self, int firstLine, Closure closure)
|
static java.lang.String
|
eachMatch(java.lang.CharSequence self, java.lang.CharSequence regex, Closure closure)
|
static java.lang.String
|
eachMatch(java.lang.CharSequence self, java.util.regex.Pattern pattern, Closure closure)
|
static java.lang.String
|
eachMatch(java.lang.String self, java.util.regex.Pattern pattern, Closure closure)
|
static java.lang.String
|
eachMatch(java.lang.String self, java.lang.String regex, Closure closure)
|
static void
|
eachObject(java.io.File self, Closure closure)
|
static void
|
eachObject(java.io.ObjectInputStream ois, Closure closure)
|
static java.util.Iterator
|
eachPermutation(java.util.Collection self, Closure closure)
|
static java.lang.Object
|
eachWithIndex(java.lang.Object self, Closure closure)
|
static java.util.Map
|
eachWithIndex(java.util.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(java.lang.Object[] left, java.util.List right)
|
static boolean
|
equals(java.util.List left, java.lang.Object[] right)
|
static boolean
|
equals(java.util.List left, java.util.List right)
|
static boolean
|
equals(java.util.Set self, java.util.Set other)
|
static boolean
|
equals(java.util.Map self, java.util.Map other)
Create a Set composed of the elements of the first Set minus the elements of the given Collection. |
static boolean
|
every(java.lang.Object self, Closure closure)
|
static boolean
|
every(java.util.Map self, Closure closure)
|
static boolean
|
every(java.lang.Object self)
|
static java.lang.Process
|
execute(java.lang.String self)
|
static java.lang.Process
|
execute(java.lang.String self, java.lang.String[] envp, java.io.File dir)
|
static java.lang.Process
|
execute(java.lang.String self, java.util.List envp, java.io.File dir)
|
static java.lang.Process
|
execute(java.lang.String[] commandArray)
|
static java.lang.Process
|
execute(java.lang.String[] commandArray, java.lang.String[] envp, java.io.File dir)
|
static java.lang.Process
|
execute(java.lang.String[] commandArray, java.util.List envp, java.io.File dir)
|
static java.lang.Process
|
execute(java.util.List commands)
|
static java.lang.Process
|
execute(java.util.List commands, java.lang.String[] envp, java.io.File dir)
|
static java.lang.Process
|
execute(java.util.List commands, java.util.List envp, java.io.File dir)
|
static java.lang.CharSequence
|
expand(java.lang.CharSequence self)
|
static java.lang.CharSequence
|
expand(java.lang.CharSequence self, int tabStop)
|
static java.lang.String
|
expand(java.lang.String self)
|
static java.lang.String
|
expand(java.lang.String self, int tabStop)
|
static java.lang.CharSequence
|
expandLine(java.lang.CharSequence self, int tabStop)
|
static java.lang.String
|
expandLine(java.lang.String self, int tabStop)
|
static void
|
filterLine(java.io.Reader reader, java.io.Writer writer, Closure closure)
|
static Writable
|
filterLine(java.io.File self, Closure closure)
|
static Writable
|
filterLine(java.io.File self, java.lang.String charset, Closure closure)
|
static void
|
filterLine(java.io.File self, java.io.Writer writer, Closure closure)
|
static void
|
filterLine(java.io.File self, java.io.Writer writer, java.lang.String charset, Closure closure)
|
static Writable
|
filterLine(java.io.Reader reader, Closure closure)
|
static Writable
|
filterLine(java.io.InputStream self, Closure predicate)
|
static Writable
|
filterLine(java.io.InputStream self, java.lang.String charset, Closure predicate)
|
static void
|
filterLine(java.io.InputStream self, java.io.Writer writer, Closure predicate)
|
static void
|
filterLine(java.io.InputStream self, java.io.Writer writer, java.lang.String charset, Closure predicate)
|
static Writable
|
filterLine(java.net.URL self, Closure predicate)
|
static Writable
|
filterLine(java.net.URL self, java.lang.String charset, Closure predicate)
|
static void
|
filterLine(java.net.URL self, java.io.Writer writer, Closure predicate)
|
static void
|
filterLine(java.net.URL self, java.io.Writer writer, java.lang.String charset, Closure predicate)
|
static java.lang.Object
|
find(java.lang.Object self, Closure closure)
|
static java.lang.Object
|
find(java.lang.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 java.lang.Object
|
find(java.util.Collection self, Closure closure)
|
static java.lang.Object
|
find(java.lang.Object[] self, Closure condition)
|
static java.lang.Object
|
find(java.util.Collection self)
|
static java.util.Map$Entry
|
find(java.util.Map self, Closure closure)
|
static java.lang.CharSequence
|
find(java.lang.CharSequence self, java.lang.CharSequence regex)
|
static java.lang.CharSequence
|
find(java.lang.CharSequence self, java.lang.CharSequence regex, Closure closure)
|
static java.lang.CharSequence
|
find(java.lang.CharSequence self, java.util.regex.Pattern pattern)
|
static java.lang.CharSequence
|
find(java.lang.CharSequence self, java.util.regex.Pattern pattern, Closure closure)
|
static java.lang.String
|
find(java.lang.String self, java.util.regex.Pattern pattern)
|
static java.lang.String
|
find(java.lang.String self, java.util.regex.Pattern pattern, Closure closure)
|
static java.lang.String
|
find(java.lang.String self, java.lang.String regex)
|
static java.lang.String
|
find(java.lang.String self, java.lang.String regex, Closure closure)
|
static java.util.Collection
|
findAll(java.util.Collection self, Closure closure)
Finds all elements of the array matching the given Closure condition. |
static java.util.Collection
|
findAll(java.lang.Object[] self, Closure condition)
|
static java.util.Collection
|
findAll(java.util.Collection self)
Finds the elements of the array matching the IDENTITY Closure (i.e. matching Groovy truth). |
static java.util.Collection
|
findAll(java.lang.Object[] self)
Finds all items matching the closure condition. |
static java.util.Collection
|
findAll(java.lang.Object self, Closure closure)
|
static java.util.Collection
|
findAll(java.lang.Object self)
|
static java.util.Map
|
findAll(java.util.Map self, Closure closure)
@deprecated Use the Iterable version of groupBy instead |
static java.util.List
|
findAll(java.lang.CharSequence self, java.lang.CharSequence regex)
|
static java.util.List
|
findAll(java.lang.CharSequence self, java.lang.CharSequence regex, Closure closure)
|
static java.util.List
|
findAll(java.lang.CharSequence self, java.util.regex.Pattern pattern)
|
static java.util.List
|
findAll(java.lang.CharSequence self, java.util.regex.Pattern pattern, Closure closure)
|
static java.util.List
|
findAll(java.lang.String self, java.util.regex.Pattern pattern)
|
static java.util.List
|
findAll(java.lang.String self, java.util.regex.Pattern pattern, Closure closure)
|
static java.util.List
|
findAll(java.lang.String self, java.lang.String regex)
|
static java.util.List
|
findAll(java.lang.String self, java.lang.String regex, Closure closure)
|
static int
|
findIndexOf(java.lang.Object self, Closure closure)
|
static int
|
findIndexOf(java.lang.Object self, int startIndex, Closure closure)
|
static java.util.List
|
findIndexValues(java.lang.Object self, Closure closure)
|
static java.util.List
|
findIndexValues(java.lang.Object self, java.lang.Number startIndex, Closure closure)
|
static int
|
findLastIndexOf(java.lang.Object self, Closure closure)
|
static int
|
findLastIndexOf(java.lang.Object self, int startIndex, Closure closure)
|
static java.lang.Object
|
findResult(java.lang.Object self, java.lang.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 java.lang.Object
|
findResult(java.lang.Object self, Closure closure)
|
static java.lang.Object
|
findResult(java.util.Collection self, java.lang.Object defaultResult, Closure closure)
|
static java.lang.Object
|
findResult(java.util.Collection self, Closure closure)
@deprecated Use the Iterable version of findResults instead |
static java.lang.Object
|
findResult(java.util.Map self, java.lang.Object defaultResult, Closure closure)
|
static java.lang.Object
|
findResult(java.util.Map self, Closure closure)
|
static java.util.Collection
|
findResults(java.util.Collection self, Closure filteringTransform)
|
static java.util.Collection
|
findResults(java.lang.Iterable self, Closure filteringTransform)
|
static java.util.Collection
|
findResults(java.util.Map self, Closure filteringTransform)
|
static java.lang.Object
|
first(java.util.List self)
|
static java.lang.Object
|
first(java.lang.Iterable self)
|
static java.lang.Object
|
first(java.lang.Object[] self)
Returns the first item from the Object array. |
static java.util.Collection
|
flatten(java.util.Collection self)
Flatten an array. |
static java.util.Collection
|
flatten(java.lang.Iterable self)
|
static java.util.Collection
|
flatten(java.lang.Object[] self)
|
static java.util.Collection
|
flatten(boolean[] self)
|
static java.util.Collection
|
flatten(byte[] self)
|
static java.util.Collection
|
flatten(char[] self)
|
static java.util.Collection
|
flatten(short[] self)
|
static java.util.Collection
|
flatten(int[] self)
|
static java.util.Collection
|
flatten(long[] self)
|
static java.util.Collection
|
flatten(float[] self)
|
static java.util.Collection
|
flatten(double[] self)
|
static java.util.Collection
|
flatten(java.util.Collection self, Closure flattenUsing)
|
static java.util.Collection
|
flatten(java.lang.Iterable self, Closure flattenUsing)
|
static java.lang.Object
|
get(java.util.Map map, java.lang.Object key, java.lang.Object defaultValue)
Support the range subscript operator for an Array |
static java.lang.Object
|
getAt(java.lang.Object self, java.lang.String property)
Allows the subscript operator to be used to lookup dynamic property values. |
static java.util.List
|
getAt(java.util.List self, Range range)
Select a List of items from an eager or lazy List using a Collection to identify the indices to be selected. |
static java.util.List
|
getAt(ListWithDefault self, java.util.Collection indices)
Support the range subscript operator for an eager or lazy List. |
static java.util.List
|
getAt(ListWithDefault self, Range range)
|
static java.util.List
|
getAt(ListWithDefault self, EmptyRange range)
Support the range subscript operator for a List. |
static java.util.List
|
getAt(java.util.List self, EmptyRange range)
|
static java.util.List
|
getAt(java.util.List self, java.util.Collection indices)
Select a List of items from an Object array using a Collection to identify the indices to be selected. |
static java.util.List
|
getAt(java.lang.Object[] self, java.util.Collection indices)
Creates a sub-Map containing the given keys. |
static java.util.List
|
getAt(java.lang.Object[] array, Range range)
@param array an Array of Objects |
static java.util.List
|
getAt(java.lang.Object[] array, IntRange range)
@param array an Array of Objects |
static java.util.List
|
getAt(java.lang.Object[] array, EmptyRange range)
Allows conversion of arrays into a mutable List. |
static java.util.List
|
getAt(java.lang.Object[] array, ObjectRange range)
|
static java.lang.Object
|
getAt(java.util.List self, int idx)
|
static java.lang.Object
|
getAt(java.util.Iterator self, int idx)
|
static java.lang.Object
|
getAt(java.lang.Iterable self, int idx)
A helper method to allow lists to work with subscript operators. |
static java.lang.Object
|
getAt(java.util.Map self, java.lang.Object key)
Returns a new |
static java.util.List
|
getAt(java.util.Collection coll, java.lang.String property)
A convenience method for creating an immutable map. |
static java.util.List
|
getAt(byte[] array, Range range)
Support the subscript operator with a range for an int array |
static java.util.List
|
getAt(char[] array, Range range)
|
static java.util.List
|
getAt(short[] array, Range range)
|
static java.util.List
|
getAt(int[] array, Range range)
|
static java.util.List
|
getAt(long[] array, Range range)
|
static java.util.List
|
getAt(float[] array, Range range)
|
static java.util.List
|
getAt(double[] array, Range range)
|
static java.util.List
|
getAt(boolean[] array, Range range)
|
static java.util.List
|
getAt(byte[] array, IntRange range)
|
static java.util.List
|
getAt(char[] array, IntRange range)
|
static java.util.List
|
getAt(short[] array, IntRange range)
|
static java.util.List
|
getAt(int[] array, IntRange range)
|
static java.util.List
|
getAt(long[] array, IntRange range)
|
static java.util.List
|
getAt(float[] array, IntRange range)
|
static java.util.List
|
getAt(double[] array, IntRange range)
|
static java.util.List
|
getAt(boolean[] array, IntRange range)
|
static java.util.List
|
getAt(byte[] array, ObjectRange range)
|
static java.util.List
|
getAt(char[] array, ObjectRange range)
|
static java.util.List
|
getAt(short[] array, ObjectRange range)
|
static java.util.List
|
getAt(int[] array, ObjectRange range)
|
static java.util.List
|
getAt(long[] array, ObjectRange range)
|
static java.util.List
|
getAt(float[] array, ObjectRange range)
|
static java.util.List
|
getAt(double[] array, ObjectRange range)
|
static java.util.List
|
getAt(boolean[] array, ObjectRange range)
|
static java.util.List
|
getAt(byte[] array, java.util.Collection indices)
|
static java.util.List
|
getAt(char[] array, java.util.Collection indices)
|
static java.util.List
|
getAt(short[] array, java.util.Collection indices)
|
static java.util.List
|
getAt(int[] array, java.util.Collection indices)
|
static java.util.List
|
getAt(long[] array, java.util.Collection indices)
|
static java.util.List
|
getAt(float[] array, java.util.Collection indices)
|
static java.util.List
|
getAt(double[] array, java.util.Collection indices)
|
static java.util.List
|
getAt(boolean[] array, java.util.Collection indices)
|
static boolean
|
getAt(java.util.BitSet self, int index)
|
static java.util.BitSet
|
getAt(java.util.BitSet self, IntRange range)
|
static java.lang.CharSequence
|
getAt(java.lang.CharSequence self, java.util.Collection indices)
|
static java.lang.CharSequence
|
getAt(java.lang.CharSequence text, EmptyRange range)
|
static java.lang.CharSequence
|
getAt(java.lang.CharSequence text, int index)
|
static java.lang.CharSequence
|
getAt(java.lang.CharSequence text, IntRange range)
|
static java.lang.CharSequence
|
getAt(java.lang.CharSequence text, Range range)
|
static java.util.List
|
getAt(java.util.regex.Matcher self, java.util.Collection indices)
|
static java.lang.Object
|
getAt(java.util.regex.Matcher matcher, int idx)
|
static java.lang.String
|
getAt(java.lang.String self, java.util.Collection indices)
|
static java.lang.String
|
getAt(java.lang.String text, EmptyRange range)
|
static java.lang.String
|
getAt(java.lang.String text, int index)
|
static java.lang.String
|
getAt(java.lang.String text, IntRange range)
|
static java.lang.String
|
getAt(java.lang.String text, Range range)
|
static byte[]
|
getBytes(java.io.File file)
|
static byte[]
|
getBytes(java.net.URL url)
|
static byte[]
|
getBytes(java.io.InputStream is)
|
static char[]
|
getChars(java.lang.CharSequence self)
|
static char[]
|
getChars(java.lang.String self)
|
static int
|
getCount(java.util.regex.Matcher matcher)
|
static MetaClass
|
getMetaClass(java.lang.Class c)
|
static MetaClass
|
getMetaClass(java.lang.Object obj)
|
static MetaClass
|
getMetaClass(GroovyObject obj)
|
static java.util.List
|
getMetaPropertyValues(java.lang.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 java.util.Map
|
getProperties(java.lang.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 java.lang.ClassLoader
|
getRootLoader(java.lang.ClassLoader self)
Convenience method to dynamically create a new instance of this class. |
protected static java.util.List
|
getSubList(java.util.List self, java.util.List splice)
|
static java.lang.String
|
getText(java.io.File file, java.lang.String charset)
|
static java.lang.String
|
getText(java.io.File file)
|
static java.lang.String
|
getText(java.net.URL url)
|
static java.lang.String
|
getText(java.net.URL url, java.util.Map parameters)
|
static java.lang.String
|
getText(java.net.URL url, java.lang.String charset)
|
static java.lang.String
|
getText(java.net.URL url, java.util.Map parameters, java.lang.String charset)
|
static java.lang.String
|
getText(java.io.InputStream is)
|
static java.lang.String
|
getText(java.io.InputStream is, java.lang.String charset)
|
static java.lang.String
|
getText(java.io.Reader reader)
|
static java.lang.String
|
getText(java.io.BufferedReader reader)
|
static java.util.Collection
|
grep(java.lang.Object self, java.lang.Object filter)
|
static java.util.Collection
|
grep(java.util.Collection self, java.lang.Object filter)
Iterates over the collection of items and returns each item that matches
the given filter - calling the |
static java.util.Collection
|
grep(java.lang.Object[] self, java.lang.Object filter)
|
static java.util.Collection
|
grep(java.lang.Object self)
|
static java.util.Collection
|
grep(java.util.Collection self)
|
static java.util.Collection
|
grep(java.lang.Object[] self)
|
protected static void
|
groupAnswer(java.util.Map answer, java.lang.Object element, java.lang.Object value)
|
static java.util.Map
|
groupBy(java.util.Collection self, Closure closure)
|
static java.util.Map
|
groupBy(java.lang.Iterable self, Closure closure)
|
static java.util.Map
|
groupBy(java.lang.Object[] self, Closure closure)
@deprecated Use the Iterable version of groupBy instead |
static java.util.Map
|
groupBy(java.util.Collection self, java.lang.Object... closures)
|
static java.util.Map
|
groupBy(java.lang.Iterable self, java.lang.Object... closures)
|
static java.util.Map
|
groupBy(java.lang.Object[] self, java.lang.Object... closures)
Sorts all array members into (sub)groups determined by the supplied mapping closures as per the Iterable variant of this method. |
static java.util.Map
|
groupBy(java.util.Collection self, java.util.List closures)
|
static java.util.Map
|
groupBy(java.lang.Iterable self, java.util.List closures)
Sorts all array members into (sub)groups determined by the supplied mapping closures as per the list variant of this method. |
static java.util.Map
|
groupBy(java.lang.Object[] self, java.util.List closures)
|
static java.util.Map
|
groupBy(java.util.Map self, Closure closure)
|
static java.util.Map
|
groupBy(java.util.Map self, java.lang.Object... closures)
|
static java.util.Map
|
groupBy(java.util.Map self, java.util.List closures)
Groups the members of a map into sub maps determined by the supplied mapping closures. |
static java.util.Map
|
groupEntriesBy(java.util.Map self, Closure closure)
|
static boolean
|
hasGroup(java.util.regex.Matcher matcher)
|
static MetaProperty
|
hasProperty(java.lang.Object self, java.lang.String name)
|
static java.lang.Object
|
head(java.util.List self)
Returns the items from the List excluding the first item. |
static java.lang.Object
|
head(java.lang.Object[] self)
|
static java.lang.Object
|
identity(java.lang.Object self, Closure closure)
|
static java.lang.Boolean
|
implies(java.lang.Boolean left, java.lang.Boolean right)
Iterates over the elements of an iterable collection of items, starting from a specified startIndex, and returns the index of the last item that matches the condition specified in the closure. |
static java.lang.Object
|
inject(java.util.Collection self, Closure closure)
|
static java.lang.Object
|
inject(java.util.Collection self, java.lang.Object initialValue, Closure closure)
|
static java.lang.Object
|
inject(java.util.Map self, java.lang.Object initialValue, Closure closure)
|
static java.lang.Object
|
inject(java.util.Iterator self, java.lang.Object initialValue, Closure closure)
|
static java.lang.Object
|
inject(java.lang.Object self, Closure closure)
Iterates through the given Object, passing in the initial value to the closure along with the first item. |
static java.lang.Object
|
inject(java.lang.Object self, java.lang.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 java.lang.Object
|
inject(java.lang.Object[] self, Closure closure)
|
static java.lang.Object
|
inject(java.lang.Object[] self, java.lang.Object initialValue, Closure closure)
@deprecated Use the Iterable version of sum instead |
static java.lang.String
|
inspect(java.lang.Object self)
Inspects returns the String that matches what would be typed into a terminal to create this object. |
static java.lang.Number
|
intdiv(java.lang.Character left, java.lang.Number right)
|
static java.lang.Number
|
intdiv(java.lang.Number left, java.lang.Character right)
|
static java.lang.Number
|
intdiv(java.lang.Character left, java.lang.Character right)
|
static java.lang.Number
|
intdiv(java.lang.Number left, java.lang.Number right)
|
static java.util.Collection
|
intersect(java.util.Collection left, java.util.Collection right)
|
static java.util.Map
|
intersect(java.util.Map left, java.util.Map right)
Returns |
static java.lang.Object
|
invokeMethod(java.lang.Object object, java.lang.String method, java.lang.Object arguments)
|
static boolean
|
is(java.lang.Object self, java.lang.Object other)
Identity check. |
static boolean
|
isAllWhitespace(java.lang.CharSequence self)
|
static boolean
|
isAllWhitespace(java.lang.String self)
|
static boolean
|
isBigDecimal(java.lang.CharSequence self)
|
static boolean
|
isBigDecimal(java.lang.String self)
|
static boolean
|
isBigInteger(java.lang.CharSequence self)
|
static boolean
|
isBigInteger(java.lang.String self)
|
static boolean
|
isCase(java.lang.Object caseValue, java.lang.Object switchValue)
|
static boolean
|
isCase(java.lang.Class caseValue, java.lang.Object switchValue)
|
static boolean
|
isCase(java.util.Collection caseValue, java.lang.Object switchValue)
|
static boolean
|
isCase(java.util.Map caseValue, java.lang.Object switchValue)
|
static boolean
|
isCase(java.lang.Number caseValue, java.lang.Number switchValue)
|
static boolean
|
isCase(java.lang.CharSequence caseValue, java.lang.Object switchValue)
|
static boolean
|
isCase(GString caseValue, java.lang.Object switchValue)
|
static boolean
|
isCase(java.util.regex.Pattern caseValue, java.lang.Object switchValue)
|
static boolean
|
isCase(java.lang.String caseValue, java.lang.Object switchValue)
|
static boolean
|
isDigit(java.lang.Character self)
|
static boolean
|
isDouble(java.lang.CharSequence self)
|
static boolean
|
isDouble(java.lang.String self)
|
static boolean
|
isFloat(java.lang.CharSequence self)
|
static boolean
|
isFloat(java.lang.String self)
|
static boolean
|
isInteger(java.lang.CharSequence self)
|
static boolean
|
isInteger(java.lang.String self)
|
static boolean
|
isLetter(java.lang.Character self)
Transform a Number into a Double |
static boolean
|
isLetterOrDigit(java.lang.Character self)
Transform a Number into a BigDecimal |
static boolean
|
isLong(java.lang.CharSequence self)
|
static boolean
|
isLong(java.lang.String self)
|
static boolean
|
isLowerCase(java.lang.Character self)
Transform a Number into a Float |
static boolean
|
isNumber(java.lang.CharSequence self)
|
static boolean
|
isNumber(java.lang.String self)
|
static boolean
|
isUpperCase(java.lang.Character self)
Transform a Number into a Long |
static boolean
|
isWhitespace(java.lang.Character self)
|
static java.util.Iterator
|
iterator(java.lang.Object[] a)
|
static java.util.Iterator
|
iterator(java.lang.Object o)
|
static java.util.Iterator
|
iterator(java.util.Enumeration enumeration)
|
static java.util.Iterator
|
iterator(java.util.Iterator self)
|
static java.util.Iterator
|
iterator(java.util.regex.Matcher matcher)
|
static java.util.Iterator
|
iterator(java.io.Reader self)
|
static java.util.Iterator
|
iterator(java.io.InputStream self)
|
static java.util.Iterator
|
iterator(java.io.DataInputStream self)
|
static java.lang.String
|
join(java.util.Iterator self, java.lang.String separator)
@deprecated Use the Iterable version of join instead |
static java.lang.String
|
join(java.util.Collection self, java.lang.String separator)
|
static java.lang.String
|
join(java.lang.Iterable self, java.lang.String separator)
|
static java.lang.String
|
join(java.lang.Object[] self, java.lang.String separator)
|
static java.lang.Object
|
last(java.util.List self)
|
static java.lang.Object
|
last(java.lang.Iterable self)
Returns the last item from the array. |
static java.lang.Object
|
last(java.lang.Object[] self)
|
static java.util.Collection
|
leftShift(java.util.Collection self, java.lang.Object value)
Overloads the left shift operator to provide an easy way to append Map.Entry values to a Map. |
static java.util.concurrent.BlockingQueue
|
leftShift(java.util.concurrent.BlockingQueue self, java.lang.Object value)
|
static java.util.Map
|
leftShift(java.util.Map self, java.util.Map$Entry entry)
|
static java.util.Map
|
leftShift(java.util.Map self, java.util.Map other)
Implementation of the right shift (unsigned) operator for integral types. |
static java.lang.Number
|
leftShift(java.lang.Number self, java.lang.Number operand)
Support the subscript operator with a range for a byte array |
static java.lang.StringBuilder
|
leftShift(java.lang.CharSequence self, java.lang.Object value)
|
static java.lang.StringBuffer
|
leftShift(java.lang.String self, java.lang.Object value)
|
static java.lang.StringBuffer
|
leftShift(java.lang.StringBuffer self, java.lang.Object value)
|
static java.lang.StringBuilder
|
leftShift(java.lang.StringBuilder self, java.lang.Object value)
|
static java.io.Writer
|
leftShift(java.net.Socket self, java.lang.Object value)
|
static java.io.OutputStream
|
leftShift(java.net.Socket self, byte[] value)
|
static java.io.Writer
|
leftShift(java.io.Writer self, java.lang.Object value)
|
static java.io.Writer
|
leftShift(java.io.OutputStream self, java.lang.Object value)
|
static void
|
leftShift(java.io.ObjectOutputStream self, java.lang.Object value)
|
static java.io.OutputStream
|
leftShift(java.io.OutputStream self, java.io.InputStream in)
|
static java.io.OutputStream
|
leftShift(java.io.OutputStream self, byte[] value)
|
static java.io.File
|
leftShift(java.io.File file, java.lang.Object text)
|
static java.io.File
|
leftShift(java.io.File file, byte[] bytes)
|
static java.io.File
|
leftShift(java.io.File file, java.io.InputStream data)
|
static boolean
|
matches(java.lang.CharSequence self, java.util.regex.Pattern pattern)
|
static boolean
|
matches(java.lang.String self, java.util.regex.Pattern pattern)
|
static java.util.Map$Entry
|
max(java.util.Map self, Closure closure)
|
static java.lang.Object
|
max(java.util.Collection self)
|
static java.lang.Object
|
max(java.lang.Iterable self)
|
static java.lang.Object
|
max(java.util.Iterator self)
@deprecated Use the Iterable version of max instead |
static java.lang.Object
|
max(java.lang.Object[] self)
|
static java.lang.Object
|
max(java.util.Collection self, Closure closure)
|
static java.lang.Object
|
max(java.lang.Iterable self, Closure closure)
|
static java.lang.Object
|
max(java.util.Iterator self, Closure closure)
Selects the maximum value found from the Object array using the closure to determine the correct ordering. |
static java.lang.Object
|
max(java.lang.Object[] self, Closure closure)
@deprecated Use the Iterable version of max instead |
static java.lang.Object
|
max(java.util.Collection self, java.util.Comparator comparator)
|
static java.lang.Object
|
max(java.lang.Iterable self, java.util.Comparator comparator)
Selects the maximum value found from the Iterator using the given comparator. |
static java.lang.Object
|
max(java.util.Iterator self, java.util.Comparator comparator)
Provide the standard Groovy |
static java.lang.Object
|
max(java.lang.Object[] self, java.util.Comparator comparator)
|
static MetaClass
|
metaClass(java.lang.Class self, Closure closure)
Allows an Enumeration to behave like an Iterator. |
static MetaClass
|
metaClass(java.lang.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 java.lang.Object
|
min(java.util.Collection self)
Adds min() method to Collection objects. |
static java.lang.Object
|
min(java.lang.Iterable self)
|
static java.lang.Object
|
min(java.util.Iterator self)
@deprecated Use the Iterable version of min instead |
static java.lang.Object
|
min(java.lang.Object[] self)
Selects the minimum value found in the Iterable using the given comparator. |
static java.lang.Object
|
min(java.util.Collection self, java.util.Comparator comparator)
|
static java.lang.Object
|
min(java.lang.Iterable self, java.util.Comparator comparator)
Selects the minimum value found from the Iterator using the given comparator. |
static java.lang.Object
|
min(java.util.Iterator self, java.util.Comparator comparator)
@deprecated Use the Iterable version of min instead |
static java.lang.Object
|
min(java.lang.Object[] self, java.util.Comparator comparator)
|
static java.lang.Object
|
min(java.util.Collection self, Closure closure)
|
static java.lang.Object
|
min(java.lang.Iterable self, Closure closure)
|
static java.util.Map$Entry
|
min(java.util.Map self, Closure closure)
|
static java.lang.Object
|
min(java.util.Iterator self, Closure closure)
Selects the minimum value found from the Object array using the closure to determine the correct ordering. |
static java.lang.Object
|
min(java.lang.Object[] self, Closure closure)
@deprecated Use the Iterable version of max instead |
static java.util.Set
|
minus(java.util.Set self, java.util.Collection removeMe)
Create a Set composed of the elements of the first Set minus the elements from the given Iterable. |
static java.util.Set
|
minus(java.util.Set self, java.lang.Iterable removeMe)
Create an array composed of the elements of the first array minus the elements of the given Iterable. |
static java.util.Set
|
minus(java.util.Set self, java.lang.Object removeMe)
|
static java.lang.Object[]
|
minus(java.lang.Object[] self, java.lang.Iterable removeMe)
Create a List composed of the elements of the first list minus every occurrence of elements of the given Collection. |
static java.lang.Object[]
|
minus(java.lang.Object[] self, java.lang.Object[] removeMe)
|
static java.util.List
|
minus(java.util.List self, java.util.Collection removeMe)
|
static java.util.List
|
minus(java.util.List self, java.lang.Iterable removeMe)
Create a List composed of the elements of the first list minus every occurrence of elements of the given Iterable. |
static java.util.List
|
minus(java.util.List self, java.lang.Object removeMe)
|
static java.lang.Object[]
|
minus(java.lang.Object[] self, java.lang.Object removeMe)
Flatten a collection. |
static java.util.Map
|
minus(java.util.Map self, java.util.Map removeMe)
|
static java.lang.Number
|
minus(java.lang.Character left, java.lang.Number right)
|
static java.lang.Number
|
minus(java.lang.Number left, java.lang.Character right)
|
static java.lang.Number
|
minus(java.lang.Character left, java.lang.Character right)
|
static java.lang.CharSequence
|
minus(java.lang.CharSequence self, java.lang.Object target)
|
static java.lang.String
|
minus(java.lang.String self, java.lang.Object target)
|
static void
|
mixin(MetaClass self, java.util.List categoryClasses)
|
static void
|
mixin(java.lang.Class self, java.util.List categoryClasses)
|
static void
|
mixin(java.lang.Class self, java.lang.Class categoryClass)
|
static void
|
mixin(java.lang.Class self, java.lang.Class[] categoryClass)
|
static void
|
mixin(MetaClass self, java.lang.Class categoryClass)
|
static void
|
mixin(MetaClass self, java.lang.Class[] categoryClass)
|
static java.lang.Number
|
mod(java.lang.Number left, java.lang.Number right)
|
static java.util.List
|
multiply(java.util.Collection self, java.lang.Number factor)
|
static java.lang.Number
|
multiply(java.lang.Character left, java.lang.Number right)
|
static java.lang.Number
|
multiply(java.lang.Number left, java.lang.Character right)
|
static java.lang.Number
|
multiply(java.lang.Character left, java.lang.Character right)
|
static java.lang.Number
|
multiply(java.math.BigDecimal left, java.lang.Double right)
Power of a long to an integer certain exponent. |
static java.lang.Number
|
multiply(java.math.BigDecimal left, java.math.BigInteger right)
|
static java.lang.CharSequence
|
multiply(java.lang.CharSequence self, java.lang.Number factor)
|
static java.lang.String
|
multiply(java.lang.String self, java.lang.Number factor)
|
static java.io.DataInputStream
|
newDataInputStream(java.io.File file)
|
static java.io.DataOutputStream
|
newDataOutputStream(java.io.File file)
|
static java.io.BufferedInputStream
|
newInputStream(java.io.File file)
|
static java.io.BufferedInputStream
|
newInputStream(java.net.URL url)
|
static java.io.BufferedInputStream
|
newInputStream(java.net.URL url, java.util.Map parameters)
|
static java.lang.Object
|
newInstance(java.lang.Class c)
Set the metaclass for an object. |
static java.lang.Object
|
newInstance(java.lang.Class c, java.lang.Object[] args)
|
static java.io.ObjectInputStream
|
newObjectInputStream(java.io.File file)
|
static java.io.ObjectInputStream
|
newObjectInputStream(java.io.InputStream inputStream)
|
static java.io.ObjectInputStream
|
newObjectInputStream(java.io.InputStream inputStream, java.lang.ClassLoader classLoader)
|
static java.io.ObjectInputStream
|
newObjectInputStream(java.io.File file, java.lang.ClassLoader classLoader)
|
static java.io.ObjectOutputStream
|
newObjectOutputStream(java.io.File file)
|
static java.io.ObjectOutputStream
|
newObjectOutputStream(java.io.OutputStream outputStream)
|
static java.io.BufferedOutputStream
|
newOutputStream(java.io.File file)
|
static java.io.PrintWriter
|
newPrintWriter(java.io.File file)
|
static java.io.PrintWriter
|
newPrintWriter(java.io.File file, java.lang.String charset)
|
static java.io.PrintWriter
|
newPrintWriter(java.io.Writer writer)
|
static java.io.BufferedReader
|
newReader(java.io.File file)
|
static java.io.BufferedReader
|
newReader(java.io.File file, java.lang.String charset)
|
static java.io.BufferedReader
|
newReader(java.io.InputStream self)
|
static java.io.BufferedReader
|
newReader(java.io.InputStream self, java.lang.String charset)
|
static java.io.BufferedReader
|
newReader(java.net.URL url)
|
static java.io.BufferedReader
|
newReader(java.net.URL url, java.util.Map parameters)
|
static java.io.BufferedReader
|
newReader(java.net.URL url, java.lang.String charset)
|
static java.io.BufferedReader
|
newReader(java.net.URL url, java.util.Map parameters, java.lang.String charset)
|
static java.io.BufferedWriter
|
newWriter(java.io.File file)
|
static java.io.BufferedWriter
|
newWriter(java.io.File file, boolean append)
|
static java.io.BufferedWriter
|
newWriter(java.io.File file, java.lang.String charset, boolean append)
|
static java.io.BufferedWriter
|
newWriter(java.io.File file, java.lang.String charset)
|
static java.lang.Character
|
next(java.lang.Character self)
Compare a Number and a Character. |
static java.lang.Number
|
next(java.lang.Number self)
Compare two Characters. |
static java.lang.CharSequence
|
next(java.lang.CharSequence self)
|
static java.lang.String
|
next(java.lang.String self)
|
static java.lang.CharSequence
|
normalize(java.lang.CharSequence self)
|
static java.lang.String
|
normalize(java.lang.String self)
|
static int
|
numberAwareCompareTo(java.lang.Comparable self, java.lang.Comparable other)
Provides a method that compares two comparables using Groovy's default number aware comparator. |
static java.lang.Number
|
or(java.lang.Number left, java.lang.Number right)
|
static java.util.BitSet
|
or(java.util.BitSet left, java.util.BitSet right)
Iterates from this number up to the given number, inclusive, incrementing by one each time. |
static java.lang.Boolean
|
or(java.lang.Boolean left, java.lang.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 java.lang.CharSequence
|
padLeft(java.lang.CharSequence self, java.lang.Number numberOfChars)
|
static java.lang.CharSequence
|
padLeft(java.lang.CharSequence self, java.lang.Number numberOfChars, java.lang.CharSequence padding)
|
static java.lang.String
|
padLeft(java.lang.String self, java.lang.Number numberOfChars)
|
static java.lang.String
|
padLeft(java.lang.String self, java.lang.Number numberOfChars, java.lang.String padding)
|
static java.lang.CharSequence
|
padRight(java.lang.CharSequence self, java.lang.Number numberOfChars)
|
static java.lang.CharSequence
|
padRight(java.lang.CharSequence self, java.lang.Number numberOfChars, java.lang.CharSequence padding)
|
static java.lang.String
|
padRight(java.lang.String self, java.lang.Number numberOfChars)
|
static java.lang.String
|
padRight(java.lang.String self, java.lang.Number numberOfChars, java.lang.String padding)
|
static java.util.Set
|
permutations(java.util.List self)
|
static java.util.List
|
permutations(java.util.List self, Closure function)
Iterates over all permutations of a collection, running a closure for each iteration. |
static java.util.Map
|
plus(java.util.Map left, java.util.Map right)
Support the subscript operator for Collection. |
static java.util.Map
|
plus(java.util.Map self, java.util.Collection entries)
|
static java.lang.Object[]
|
plus(java.lang.Object[] left, java.lang.Object[] right)
|
static java.lang.Object[]
|
plus(java.lang.Object[] left, java.lang.Object right)
|
static java.lang.Object[]
|
plus(java.lang.Object[] left, java.util.Collection right)
|
static java.lang.Object[]
|
plus(java.lang.Object[] left, java.lang.Iterable right)
Create a Collection as a union of a Collection and an Iterable. |
static java.util.Collection
|
plus(java.util.Collection left, java.util.Collection right)
|
static java.util.Collection
|
plus(java.util.Collection left, java.lang.Iterable right)
|
static java.util.List
|
plus(java.util.List self, int index, java.lang.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 java.util.List
|
plus(java.util.List self, int index, java.util.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 java.util.List
|
plus(java.util.List self, int index, java.lang.Iterable additions)
Create a List composed of the elements of this list, repeated a certain number of times. |
static java.util.Collection
|
plus(java.util.Collection left, java.lang.Object right)
|
static java.lang.Number
|
plus(java.lang.Character left, java.lang.Number right)
|
static java.lang.Number
|
plus(java.lang.Number left, java.lang.Character right)
|
static java.lang.Number
|
plus(java.lang.Character left, java.lang.Character right)
Multiply a Character by a Number. |
static java.lang.CharSequence
|
plus(java.lang.CharSequence left, java.lang.Object value)
|
static java.lang.String
|
plus(java.lang.Number value, java.lang.String right)
|
static java.lang.String
|
plus(java.lang.String left, java.lang.Object value)
|
static java.lang.String
|
plus(java.lang.StringBuffer left, java.lang.String value)
|
static java.lang.Object
|
pop(java.util.List self)
|
static java.lang.Number
|
power(java.lang.Number self, java.lang.Number exponent)
|
static java.lang.Number
|
power(java.math.BigDecimal self, java.lang.Integer exponent)
Divide one Character by another. |
static java.lang.Number
|
power(java.math.BigInteger self, java.lang.Integer exponent)
Integer Divide a Character by a Number. |
static java.lang.Number
|
power(java.lang.Integer self, java.lang.Integer exponent)
|
static java.lang.Number
|
power(java.lang.Long self, java.lang.Integer exponent)
Integer Divide two Numbers. |
static java.lang.Character
|
previous(java.lang.Character self)
|
static java.lang.Number
|
previous(java.lang.Number self)
@todo maybe a double dispatch thing to handle new large numbers? |
static java.lang.CharSequence
|
previous(java.lang.CharSequence self)
|
static java.lang.String
|
previous(java.lang.String self)
|
protected static java.lang.Object
|
primitiveArrayGet(java.lang.Object self, int idx)
Checks whether the array contains the given value. |
protected static java.util.List
|
primitiveArrayGet(java.lang.Object self, Range range)
|
protected static java.util.List
|
primitiveArrayGet(java.lang.Object self, java.util.Collection indices)
Checks whether the array contains the given value. |
protected static java.lang.Object
|
primitiveArrayPut(java.lang.Object self, int idx, java.lang.Object newValue)
Checks whether the array contains the given value. |
static void
|
print(java.lang.Object self, java.lang.Object value)
Print a value formatted Groovy style to self if it is a Writer, otherwise to the standard output stream. |
static void
|
print(java.io.PrintWriter self, java.lang.Object value)
Print a value formatted Groovy style to the print writer. |
static void
|
print(java.io.PrintStream self, java.lang.Object value)
|
static void
|
print(Closure self, java.lang.Object value)
|
static void
|
print(java.lang.Object self, java.io.PrintWriter out)
|
static void
|
printf(java.lang.Object self, java.lang.String format, java.lang.Object[] values)
|
static void
|
printf(java.lang.Object self, java.lang.String format, java.lang.Object arg)
|
static void
|
println(java.lang.Object self)
|
static void
|
println(Closure self)
Print a linebreak to the standard output stream. |
static void
|
println(java.lang.Object self, java.lang.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(java.io.PrintWriter self, java.lang.Object value)
Print a value formatted Groovy style (followed by a newline) to the print writer. |
static void
|
println(java.io.PrintStream self, java.lang.Object value)
|
static void
|
println(Closure self, java.lang.Object value)
|
static void
|
println(java.lang.Object self, java.io.PrintWriter out)
|
static boolean
|
push(java.util.List self, java.lang.Object value)
|
static java.util.Map
|
putAll(java.util.Map self, java.util.Collection entries)
|
static void
|
putAt(java.lang.Object self, java.lang.String property, java.lang.Object newValue)
|
static void
|
putAt(java.util.List self, int idx, java.lang.Object value)
|
static void
|
putAt(java.util.List self, EmptyRange range, java.lang.Object value)
A helper method to allow lists to work with subscript operators. |
static void
|
putAt(java.util.List self, EmptyRange range, java.util.Collection value)
|
static void
|
putAt(java.util.List self, IntRange range, java.util.Collection col)
List subscript assignment operator when given a range as the index. |
static void
|
putAt(java.util.List self, IntRange range, java.lang.Object value)
|
static void
|
putAt(java.util.List self, java.util.List splice, java.util.List values)
A helper method to allow lists to work with subscript operators. |
static void
|
putAt(java.util.List self, java.util.List splice, java.lang.Object value)
|
static java.lang.Object
|
putAt(java.util.Map self, java.lang.Object key, java.lang.Object value)
|
static void
|
putAt(java.util.BitSet self, IntRange range, boolean value)
Support assigning a range of values with a single assignment statement. |
static void
|
putAt(java.util.BitSet self, int index, boolean value)
Converts this array to a List of the same size, with each element added to the list. |
static void
|
putAt(java.lang.StringBuffer self, EmptyRange range, java.lang.Object value)
|
static void
|
putAt(java.lang.StringBuffer self, IntRange range, java.lang.Object value)
|
static byte[]
|
readBytes(java.io.File file)
|
static java.lang.String
|
readLine(java.io.Reader self)
|
static java.util.List
|
readLines(java.lang.CharSequence self)
|
static java.util.List
|
readLines(java.lang.String self)
|
static java.util.List
|
readLines(java.io.File file)
|
static java.util.List
|
readLines(java.io.File file, java.lang.String charset)
|
static java.util.List
|
readLines(java.io.InputStream stream)
|
static java.util.List
|
readLines(java.io.InputStream stream, java.lang.String charset)
|
static java.util.List
|
readLines(java.net.URL self)
|
static java.util.List
|
readLines(java.net.URL self, java.lang.String charset)
|
static java.util.List
|
readLines(java.io.Reader reader)
|
static boolean
|
removeAll(java.util.Collection self, java.lang.Object[] items)
|
static boolean
|
removeAll(java.util.Collection self, Closure condition)
|
static boolean
|
renameTo(java.io.File self, java.lang.String newPathName)
|
static java.lang.CharSequence
|
replaceAll(java.lang.CharSequence self, java.lang.CharSequence regex, java.lang.CharSequence replacement)
|
static java.lang.CharSequence
|
replaceAll(java.lang.CharSequence self, java.lang.CharSequence regex, Closure closure)
|
static java.lang.CharSequence
|
replaceAll(java.lang.CharSequence self, java.util.regex.Pattern pattern, java.lang.CharSequence replacement)
|
static java.lang.String
|
replaceAll(java.lang.CharSequence self, java.util.regex.Pattern pattern, Closure closure)
|
static java.lang.String
|
replaceAll(java.lang.String self, java.util.regex.Pattern pattern, Closure closure)
|
static java.lang.String
|
replaceAll(java.lang.String self, java.util.regex.Pattern pattern, java.lang.String replacement)
|
static java.lang.String
|
replaceAll(java.lang.String self, java.lang.String regex, Closure closure)
|
static java.lang.String
|
replaceFirst(java.lang.CharSequence self, java.lang.CharSequence regex, java.lang.CharSequence replacement)
|
static java.lang.String
|
replaceFirst(java.lang.CharSequence self, java.lang.CharSequence regex, Closure closure)
|
static java.lang.CharSequence
|
replaceFirst(java.lang.CharSequence self, java.util.regex.Pattern pattern, java.lang.CharSequence replacement)
|
static java.lang.String
|
replaceFirst(java.lang.CharSequence self, java.util.regex.Pattern pattern, Closure closure)
|
static java.lang.String
|
replaceFirst(java.lang.String self, java.util.regex.Pattern pattern, Closure closure)
|
static java.lang.String
|
replaceFirst(java.lang.String self, java.util.regex.Pattern pattern, java.lang.String replacement)
|
static java.lang.String
|
replaceFirst(java.lang.String self, java.lang.String regex, Closure closure)
|
static java.util.List
|
respondsTo(java.lang.Object self, java.lang.String name, java.lang.Object[] argTypes)
|
static java.util.List
|
respondsTo(java.lang.Object self, java.lang.String name)
|
static boolean
|
retainAll(java.util.Collection self, java.lang.Object[] items)
|
static boolean
|
retainAll(java.util.Collection self, Closure condition)
|
static java.util.List
|
reverse(java.util.List self)
Reverses the elements in a list. |
static java.util.List
|
reverse(java.util.List self, boolean mutate)
|
static java.lang.Object[]
|
reverse(java.lang.Object[] self)
Reverses the iterator. |
static java.lang.Object[]
|
reverse(java.lang.Object[] self, boolean mutate)
|
static java.util.Iterator
|
reverse(java.util.Iterator self)
Create an array containing elements from an original array plus an additional appended element. |
static java.lang.CharSequence
|
reverse(java.lang.CharSequence self)
|
static java.lang.String
|
reverse(java.lang.String self)
|
static java.util.Map
|
reverseEach(java.util.Map self, Closure closure)
|
static java.util.List
|
reverseEach(java.util.List self, Closure closure)
|
static java.lang.Object[]
|
reverseEach(java.lang.Object[] self, Closure closure)
|
static java.lang.Number
|
rightShift(java.lang.Number self, java.lang.Number operand)
Support the subscript operator with a range for a char array |
static java.lang.Number
|
rightShiftUnsigned(java.lang.Number self, java.lang.Number operand)
Support the subscript operator with a range for a short array |
static int
|
round(java.lang.Float number)
|
static float
|
round(java.lang.Float number, int precision)
|
static long
|
round(java.lang.Double number)
|
static double
|
round(java.lang.Double number, int precision)
|
static java.util.TimerTask
|
runAfter(java.util.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(java.io.File file, byte[] bytes)
|
static void
|
setBytes(java.io.OutputStream os, byte[] bytes)
|
static void
|
setIndex(java.util.regex.Matcher matcher, int idx)
|
static void
|
setMetaClass(java.lang.Class self, MetaClass metaClass)
|
static void
|
setMetaClass(java.lang.Object self, MetaClass metaClass)
|
static void
|
setMetaClass(GroovyObject self, MetaClass metaClass)
Attempts to create an Iterator for the given object by first converting it to a Collection. |
static void
|
setText(java.io.File file, java.lang.String text)
|
static void
|
setText(java.io.File file, java.lang.String text, java.lang.String charset)
|
static int
|
size(java.util.Iterator self)
|
static int
|
size(java.lang.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(java.lang.CharSequence text)
|
static long
|
size(java.util.regex.Matcher self)
|
static int
|
size(java.lang.String text)
|
static int
|
size(java.lang.StringBuffer buffer)
|
static long
|
size(java.io.File self)
|
static java.util.List
|
sort(java.util.Collection self)
|
static java.util.List
|
sort(java.lang.Iterable self)
|
static java.util.List
|
sort(java.util.Collection self, boolean mutate)
|
static java.util.List
|
sort(java.lang.Iterable self, boolean mutate)
|
static java.util.Map
|
sort(java.util.Map self, Closure closure)
|
static java.util.Map
|
sort(java.util.Map self, java.util.Comparator comparator)
Modifies this array so that its elements are in sorted order. |
static java.util.Map
|
sort(java.util.Map self)
|
static java.lang.Object[]
|
sort(java.lang.Object[] self)
|
static java.lang.Object[]
|
sort(java.lang.Object[] self, boolean mutate)
Sorts the given iterator items into a sorted iterator using the comparator. |
static java.util.Iterator
|
sort(java.util.Iterator self)
@deprecated Use the Iterable version of sort instead |
static java.util.Iterator
|
sort(java.util.Iterator self, java.util.Comparator comparator)
|
static java.util.List
|
sort(java.util.Collection self, java.util.Comparator comparator)
@deprecated Use the Iterable version of sort instead |
static java.util.List
|
sort(java.lang.Iterable self, java.util.Comparator comparator)
|
static java.util.List
|
sort(java.util.Collection self, boolean mutate, java.util.Comparator comparator)
|
static java.util.List
|
sort(java.lang.Iterable self, boolean mutate, java.util.Comparator comparator)
|
static java.lang.Object[]
|
sort(java.lang.Object[] self, java.util.Comparator comparator)
|
static java.lang.Object[]
|
sort(java.lang.Object[] self, boolean mutate, java.util.Comparator comparator)
|
static java.util.Iterator
|
sort(java.util.Iterator self, Closure closure)
|
static java.lang.Object[]
|
sort(java.lang.Object[] self, Closure closure)
|
static java.lang.Object[]
|
sort(java.lang.Object[] self, boolean mutate, Closure closure)
Sorts this Collection using the given Closure to determine the correct ordering. |
static java.util.List
|
sort(java.util.Collection self, Closure closure)
Sorts this Iterable using the given Closure to determine the correct ordering. |
static java.util.List
|
sort(java.lang.Iterable self, Closure closure)
|
static java.util.List
|
sort(java.util.Collection self, boolean mutate, Closure closure)
|
static java.util.List
|
sort(java.lang.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 java.util.SortedSet
|
sort(java.util.SortedSet self)
Removes the last item from the List. |
static java.util.SortedMap
|
sort(java.util.SortedMap self)
Provides an easy way to append multiple Map.Entry values to a Map. |
static java.util.Collection
|
split(java.lang.Object self, Closure closure)
|
static java.util.Collection
|
split(java.util.Collection self, Closure closure)
|
static java.lang.CharSequence[]
|
split(java.lang.CharSequence self)
|
static java.lang.String[]
|
split(GString self)
|
static java.lang.String[]
|
split(java.lang.String self)
|
static java.lang.Object
|
splitEachLine(java.lang.CharSequence self, java.lang.CharSequence regex, Closure closure)
|
static java.lang.Object
|
splitEachLine(java.lang.CharSequence self, java.util.regex.Pattern pattern, Closure closure)
|
static java.lang.Object
|
splitEachLine(java.lang.String self, java.util.regex.Pattern pattern, Closure closure)
|
static java.lang.Object
|
splitEachLine(java.lang.String self, java.lang.String regex, Closure closure)
|
static java.lang.Object
|
splitEachLine(java.io.File self, java.lang.String regex, Closure closure)
|
static java.lang.Object
|
splitEachLine(java.io.File self, java.util.regex.Pattern pattern, Closure closure)
|
static java.lang.Object
|
splitEachLine(java.io.File self, java.lang.String regex, java.lang.String charset, Closure closure)
|
static java.lang.Object
|
splitEachLine(java.io.File self, java.util.regex.Pattern pattern, java.lang.String charset, Closure closure)
|
static java.lang.Object
|
splitEachLine(java.net.URL self, java.lang.String regex, Closure closure)
|
static java.lang.Object
|
splitEachLine(java.net.URL self, java.util.regex.Pattern pattern, Closure closure)
|
static java.lang.Object
|
splitEachLine(java.net.URL self, java.lang.String regex, java.lang.String charset, Closure closure)
|
static java.lang.Object
|
splitEachLine(java.net.URL self, java.util.regex.Pattern pattern, java.lang.String charset, Closure closure)
|
static java.lang.Object
|
splitEachLine(java.io.Reader self, java.lang.String regex, Closure closure)
|
static java.lang.Object
|
splitEachLine(java.io.Reader self, java.util.regex.Pattern pattern, Closure closure)
|
static java.lang.Object
|
splitEachLine(java.io.InputStream stream, java.lang.String regex, java.lang.String charset, Closure closure)
|
static java.lang.Object
|
splitEachLine(java.io.InputStream stream, java.util.regex.Pattern pattern, java.lang.String charset, Closure closure)
|
static java.lang.Object
|
splitEachLine(java.io.InputStream stream, java.lang.String regex, Closure closure)
|
static java.lang.Object
|
splitEachLine(java.io.InputStream stream, java.util.regex.Pattern pattern, Closure closure)
|
static SpreadMap
|
spread(java.util.Map self)
|
static java.lang.String
|
sprintf(java.lang.Object self, java.lang.String format, java.lang.Object[] values)
|
static java.lang.String
|
sprintf(java.lang.Object self, java.lang.String format, java.lang.Object arg)
|
static void
|
step(java.lang.Number self, java.lang.Number to, java.lang.Number stepNumber, Closure closure)
Get the absolute value |
static java.lang.CharSequence
|
stripIndent(java.lang.CharSequence self)
|
static java.lang.CharSequence
|
stripIndent(java.lang.CharSequence self, int numChars)
|
static java.lang.String
|
stripIndent(java.lang.String self)
|
static java.lang.String
|
stripIndent(java.lang.String self, int numChars)
|
static java.lang.CharSequence
|
stripMargin(java.lang.CharSequence self)
|
static java.lang.CharSequence
|
stripMargin(java.lang.CharSequence self, char marginChar)
|
static java.lang.String
|
stripMargin(java.lang.CharSequence self, java.lang.CharSequence marginChar)
|
static java.lang.String
|
stripMargin(java.lang.String self)
|
static java.lang.String
|
stripMargin(java.lang.String self, char marginChar)
|
static java.lang.String
|
stripMargin(java.lang.String self, java.lang.String marginChar)
|
static java.util.Map
|
subMap(java.util.Map map, java.util.Collection keys)
Creates a sub-Map containing the given keys. |
static java.util.Map
|
subMap(java.util.Map map, java.lang.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 java.util.Set
|
subsequences(java.util.List self)
Finds all permutations of a collection. |
static java.lang.Object
|
sum(java.util.Collection self)
|
static java.lang.Object
|
sum(java.lang.Iterable self)
|
static java.lang.Object
|
sum(java.lang.Object[] self)
@deprecated Use the Iterable version of sum instead |
static java.lang.Object
|
sum(java.util.Iterator self)
|
static java.lang.Object
|
sum(java.util.Collection self, java.lang.Object initialValue)
|
static java.lang.Object
|
sum(java.lang.Iterable self, java.lang.Object initialValue)
|
static java.lang.Object
|
sum(java.lang.Object[] self, java.lang.Object initialValue)
|
static java.lang.Object
|
sum(java.util.Iterator self, java.lang.Object initialValue)
|
static java.lang.Object
|
sum(java.util.Collection self, Closure closure)
Sums the result of apply a closure to each item of an Iterable. |
static java.lang.Object
|
sum(java.lang.Iterable self, Closure closure)
|
static java.lang.Object
|
sum(java.lang.Object[] self, Closure closure)
|
static java.lang.Object
|
sum(java.util.Iterator self, Closure closure)
|
static java.lang.Object
|
sum(java.util.Collection self, java.lang.Object initialValue, Closure closure)
|
static java.lang.Object
|
sum(java.lang.Iterable self, java.lang.Object initialValue, Closure closure)
|
static java.lang.Object
|
sum(java.lang.Object[] self, java.lang.Object initialValue, Closure closure)
|
static java.lang.Object
|
sum(java.util.Iterator self, java.lang.Object initialValue, Closure closure)
|
static java.util.List
|
tail(java.util.List self)
|
static java.lang.Object[]
|
tail(java.lang.Object[] self)
|
static java.util.List
|
take(java.util.List self, int num)
Returns the first |
static java.lang.Object[]
|
take(java.lang.Object[] self, int num)
|
static java.util.List
|
take(java.lang.Iterable self, int num)
Returns a new map containing the first |
static java.util.Map
|
take(java.util.Map self, int num)
Returns an iterator of up to the first |
static java.util.Iterator
|
take(java.util.Iterator self, int num)
|
static java.lang.CharSequence
|
take(java.lang.CharSequence self, int num)
|
static java.util.List
|
takeWhile(java.util.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 java.util.List
|
takeWhile(java.lang.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 java.util.Map
|
takeWhile(java.util.Map self, Closure condition)
Returns the longest prefix of this array where each element passed to the given closure evaluates to true. |
static java.lang.Object[]
|
takeWhile(java.lang.Object[] self, Closure condition)
|
static java.util.Iterator
|
takeWhile(java.util.Iterator self, Closure condition)
|
static void
|
times(java.lang.Number self, Closure closure)
|
static java.lang.String
|
toArrayString(java.lang.Object[] self)
|
static java.math.BigDecimal
|
toBigDecimal(java.lang.Number self)
Logical implication of two boolean operators |
static java.math.BigDecimal
|
toBigDecimal(java.lang.CharSequence self)
|
static java.math.BigDecimal
|
toBigDecimal(java.lang.String self)
|
static java.math.BigInteger
|
toBigInteger(java.lang.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 java.math.BigInteger
|
toBigInteger(java.lang.CharSequence self)
|
static java.math.BigInteger
|
toBigInteger(java.lang.String self)
|
static java.lang.Boolean
|
toBoolean(java.lang.Boolean self)
|
static java.lang.Boolean
|
toBoolean(java.lang.String self)
|
static java.lang.Character
|
toCharacter(java.lang.String self)
|
static java.lang.Double
|
toDouble(java.lang.Number self)
|
static java.lang.Double
|
toDouble(java.lang.CharSequence self)
|
static java.lang.Double
|
toDouble(java.lang.String self)
|
static java.lang.Float
|
toFloat(java.lang.Number self)
|
static java.lang.Float
|
toFloat(java.lang.CharSequence self)
|
static java.lang.Float
|
toFloat(java.lang.String self)
|
static java.lang.Integer
|
toInteger(java.lang.Number self)
|
static java.lang.Integer
|
toInteger(java.lang.CharSequence self)
|
static java.lang.Integer
|
toInteger(java.lang.String self)
|
static java.util.List
|
toList(java.util.Collection self)
Convert an iterator to a List. |
static java.util.List
|
toList(java.util.Iterator self)
|
static java.util.List
|
toList(java.lang.Iterable self)
Convert an enumeration to a List. |
static java.util.List
|
toList(java.util.Enumeration self)
|
static java.util.List
|
toList(java.lang.Object[] array)
|
static java.util.List
|
toList(byte[] array)
|
static java.util.List
|
toList(boolean[] array)
|
static java.util.List
|
toList(char[] array)
|
static java.util.List
|
toList(short[] array)
|
static java.util.List
|
toList(int[] array)
|
static java.util.List
|
toList(long[] array)
|
static java.util.List
|
toList(float[] array)
|
static java.util.List
|
toList(double[] array)
|
static java.util.List
|
toList(java.lang.CharSequence self)
|
static java.util.List
|
toList(java.lang.String self)
|
static java.lang.String
|
toListString(java.util.Collection self)
|
static java.lang.String
|
toListString(java.util.Collection self, int maxSize)
|
static java.lang.Long
|
toLong(java.lang.Number self)
|
static java.lang.Long
|
toLong(java.lang.CharSequence self)
|
static java.lang.Long
|
toLong(java.lang.String self)
|
static char
|
toLowerCase(java.lang.Character self)
|
static java.lang.String
|
toMapString(java.util.Map self)
|
static java.lang.String
|
toMapString(java.util.Map self, int maxSize)
|
static java.util.Set
|
toSet(byte[] array)
|
static java.util.Set
|
toSet(boolean[] array)
|
static java.util.Set
|
toSet(char[] array)
|
static java.util.Set
|
toSet(short[] array)
|
static java.util.Set
|
toSet(int[] array)
|
static java.util.Set
|
toSet(long[] array)
|
static java.util.Set
|
toSet(float[] array)
Implements the getAt(Collection) method for primitive type arrays. |
static java.util.Set
|
toSet(double[] array)
|
static java.util.Set
|
toSet(java.util.Collection self)
Implements the setAt(int idx) method for primitive type arrays. |
static java.util.Set
|
toSet(java.util.Iterator self)
Checks whether the array contains the given value. |
static java.util.Set
|
toSet(java.util.Enumeration self)
Checks whether the array contains the given value. |
static java.util.Set
|
toSet(java.lang.CharSequence self)
|
static java.util.Set
|
toSet(java.lang.String self)
|
static java.lang.Short
|
toShort(java.lang.CharSequence self)
|
static java.lang.Short
|
toShort(java.lang.String self)
|
static SpreadMap
|
toSpreadMap(java.util.Map self)
Creates a spreadable map from this array. |
static SpreadMap
|
toSpreadMap(java.lang.Object[] self)
|
static SpreadMap
|
toSpreadMap(java.util.List self)
|
static java.lang.String
|
toString(boolean[] self)
|
static java.lang.String
|
toString(byte[] self)
|
static java.lang.String
|
toString(char[] self)
|
static java.lang.String
|
toString(short[] self)
|
static java.lang.String
|
toString(int[] self)
Returns the string representation of the given list. |
static java.lang.String
|
toString(long[] self)
|
static java.lang.String
|
toString(float[] self)
|
static java.lang.String
|
toString(double[] self)
|
static java.lang.String
|
toString(java.util.AbstractMap self)
|
static java.lang.String
|
toString(java.util.AbstractCollection self)
Decrement a Number by one. |
static java.lang.String
|
toString(java.lang.Object[] self)
|
static java.lang.String
|
toString(java.lang.Object value)
|
static java.net.URI
|
toURI(java.lang.CharSequence self)
|
static java.net.URI
|
toURI(java.lang.String self)
|
static java.net.URL
|
toURL(java.lang.CharSequence self)
|
static java.net.URL
|
toURL(java.lang.String self)
|
static char
|
toUpperCase(java.lang.Character self)
|
static java.util.List
|
tokenize(java.lang.CharSequence self)
|
static java.util.List
|
tokenize(java.lang.CharSequence self, java.lang.Character token)
|
static java.util.List
|
tokenize(java.lang.CharSequence self, java.lang.CharSequence token)
|
static java.util.List
|
tokenize(java.lang.String self)
|
static java.util.List
|
tokenize(java.lang.String self, java.lang.Character token)
|
static java.util.List
|
tokenize(java.lang.String self, java.lang.String token)
|
static java.lang.CharSequence
|
tr(java.lang.CharSequence self, java.lang.CharSequence sourceSet, java.lang.CharSequence replacementSet)
|
static java.lang.String
|
tr(java.lang.String self, java.lang.String sourceSet, java.lang.String replacementSet)
|
static void
|
transformChar(java.io.Reader self, java.io.Writer writer, Closure closure)
|
static void
|
transformLine(java.io.Reader reader, java.io.Writer writer, Closure closure)
|
static java.util.List
|
transpose(java.util.List self)
|
static void
|
traverse(java.io.File self, java.util.Map options, Closure closure)
|
static void
|
traverse(java.io.File self, Closure closure)
|
static void
|
traverse(java.io.File self, java.util.Map options)
|
static float
|
trunc(java.lang.Float number, int precision)
|
static float
|
trunc(java.lang.Float number)
|
static double
|
trunc(java.lang.Double number)
|
static double
|
trunc(java.lang.Double number, int precision)
Transform a Number into an Integer |
static java.lang.Number
|
unaryMinus(java.lang.Number left)
Iterates from this number up to the given number, inclusive, incrementing by one each time. |
static java.lang.CharSequence
|
unexpand(java.lang.CharSequence self)
|
static java.lang.CharSequence
|
unexpand(java.lang.CharSequence self, int tabStop)
|
static java.lang.String
|
unexpand(java.lang.String self)
|
static java.lang.String
|
unexpand(java.lang.String self, int tabStop)
|
static java.lang.CharSequence
|
unexpandLine(java.lang.CharSequence self, int tabStop)
|
static java.lang.String
|
unexpandLine(java.lang.String self, int tabStop)
|
static java.util.Iterator
|
unique(java.util.Iterator self)
|
static java.util.Collection
|
unique(java.util.Collection self)
|
static java.util.Collection
|
unique(java.util.Collection self, boolean mutate)
|
static java.util.Iterator
|
unique(java.util.Iterator self, Closure closure)
|
static java.util.Collection
|
unique(java.util.Collection self, Closure closure)
|
static java.util.Collection
|
unique(java.util.Collection self, boolean mutate, Closure closure)
|
static java.util.Iterator
|
unique(java.util.Iterator self, java.util.Comparator comparator)
Returns an iterator equivalent to this iterator with all duplicated items removed by using the supplied comparator. |
static java.util.Collection
|
unique(java.util.Collection self, java.util.Comparator comparator)
|
static java.util.Collection
|
unique(java.util.Collection self, boolean mutate, java.util.Comparator comparator)
|
static void
|
upto(java.lang.Number self, java.lang.Number to, Closure closure)
|
static void
|
upto(long self, java.lang.Number to, Closure closure)
|
static void
|
upto(java.lang.Long self, java.lang.Number to, Closure closure)
|
static void
|
upto(float self, java.lang.Number to, Closure closure)
|
static void
|
upto(java.lang.Float self, java.lang.Number to, Closure closure)
|
static void
|
upto(double self, java.lang.Number to, Closure closure)
|
static void
|
upto(java.lang.Double self, java.lang.Number to, Closure closure)
Iterates from this number down to the given number, inclusive, decrementing by one each time. |
static void
|
upto(java.math.BigInteger self, java.lang.Number to, Closure closure)
Iterates from this number down to the given number, inclusive, decrementing by one each time. |
static void
|
upto(java.math.BigDecimal self, java.lang.Number to, Closure closure)
Iterates from this number down to the given number, inclusive, decrementing by one each time. |
static java.lang.Object
|
use(java.lang.Object self, java.lang.Class categoryClass, Closure closure)
Scoped use method |
static java.lang.Object
|
use(java.lang.Object self, java.util.List categoryClassList, Closure closure)
|
static java.lang.Object
|
use(java.lang.Object self, java.lang.Object[] array)
|
static java.lang.Object
|
with(java.lang.Object self, Closure closure)
|
static java.lang.Object
|
withDataInputStream(java.io.File file, Closure closure)
|
static java.lang.Object
|
withDataOutputStream(java.io.File file, Closure closure)
|
static java.util.Map
|
withDefault(java.util.Map self, Closure init)
An alias for |
static java.util.List
|
withDefault(java.util.List self, Closure init)
|
static java.util.List
|
withEagerDefault(java.util.List self, Closure init)
@deprecated Use the Iterable version of sort instead |
static java.lang.Object
|
withInputStream(java.io.File file, Closure closure)
|
static java.lang.Object
|
withInputStream(java.net.URL url, Closure closure)
|
static java.util.List
|
withLazyDefault(java.util.List self, Closure init)
|
static java.lang.Object
|
withObjectInputStream(java.io.File file, Closure closure)
|
static java.lang.Object
|
withObjectInputStream(java.io.File file, java.lang.ClassLoader classLoader, Closure closure)
|
static java.lang.Object
|
withObjectInputStream(java.io.InputStream inputStream, Closure closure)
|
static java.lang.Object
|
withObjectInputStream(java.io.InputStream inputStream, java.lang.ClassLoader classLoader, Closure closure)
|
static java.lang.Object
|
withObjectOutputStream(java.io.File file, Closure closure)
|
static java.lang.Object
|
withObjectOutputStream(java.io.OutputStream outputStream, Closure closure)
|
static java.lang.Object
|
withObjectStreams(java.net.Socket socket, Closure closure)
|
static java.lang.Object
|
withOutputStream(java.io.File file, Closure closure)
|
static java.lang.Object
|
withPrintWriter(java.io.File file, Closure closure)
|
static java.lang.Object
|
withPrintWriter(java.io.File file, java.lang.String charset, Closure closure)
|
static java.lang.Object
|
withPrintWriter(java.io.Writer writer, Closure closure)
|
static java.lang.Object
|
withReader(java.io.File file, Closure closure)
|
static java.lang.Object
|
withReader(java.io.File file, java.lang.String charset, Closure closure)
|
static java.lang.Object
|
withReader(java.io.Reader reader, Closure closure)
|
static java.lang.Object
|
withReader(java.net.URL url, Closure closure)
|
static java.lang.Object
|
withReader(java.net.URL url, java.lang.String charset, Closure closure)
|
static java.lang.Object
|
withReader(java.io.InputStream in, Closure closure)
|
static java.lang.Object
|
withReader(java.io.InputStream in, java.lang.String charset, Closure closure)
|
static java.lang.Object
|
withStream(java.io.InputStream stream, Closure closure)
|
static java.lang.Object
|
withStream(java.io.OutputStream os, Closure closure)
|
static java.lang.Object
|
withStreams(java.net.Socket socket, Closure closure)
|
static java.lang.Object
|
withWriter(java.io.File file, Closure closure)
|
static java.lang.Object
|
withWriter(java.io.File file, java.lang.String charset, Closure closure)
|
static java.lang.Object
|
withWriter(java.io.Writer writer, Closure closure)
|
static java.lang.Object
|
withWriter(java.io.OutputStream stream, Closure closure)
|
static java.lang.Object
|
withWriter(java.io.OutputStream stream, java.lang.String charset, Closure closure)
|
static java.lang.Object
|
withWriterAppend(java.io.File file, java.lang.String charset, Closure closure)
|
static java.lang.Object
|
withWriterAppend(java.io.File file, Closure closure)
|
static void
|
write(java.io.Writer self, Writable writable)
|
static void
|
write(java.io.File file, java.lang.String text)
|
static void
|
write(java.io.File file, java.lang.String text, java.lang.String charset)
|
static void
|
writeLine(java.io.BufferedWriter writer, java.lang.String line)
|
static java.util.BitSet
|
xor(java.util.BitSet left, java.util.BitSet right)
|
static java.lang.Number
|
xor(java.lang.Number left, java.lang.Number right)
|
static java.lang.Boolean
|
xor(java.lang.Boolean left, java.lang.Boolean right)
|
Methods inherited from class java.lang.Object | |
---|---|
java.lang.Object#wait(long, int), java.lang.Object#wait(long), java.lang.Object#wait(), java.lang.Object#equals(java.lang.Object), java.lang.Object#toString(), java.lang.Object#hashCode(), java.lang.Object#getClass(), java.lang.Object#notify(), java.lang.Object#notifyAll() |
Field Detail |
---|
public static final java.lang.Class[] DGM_LIKE_CLASSES
public static final java.lang.Class[] additionals
Method Detail |
---|
public static int abs(java.lang.Number number)
number
- a Floatprecision
- the number of decimal places to keep
public static long abs(java.lang.Long number)
public static float abs(java.lang.Float number)
public static double abs(java.lang.Double number)
self
- a Character
@java.lang.Deprecatedreturn IOGroovyMethods.eachLine(stream, charset, closure); public static java.net.Socket accept(java.net.ServerSocket serverSocket, Closure closure)
@java.lang.Deprecatedreturn IOGroovyMethods.eachLine(stream, charset, firstLine, closure); public static java.net.Socket accept(java.net.ServerSocket serverSocket, boolean runInANewThread, Closure closure)
public static boolean addAll(java.util.Collection self, java.lang.Object[] items)
public static boolean addAll(java.util.List self, int index, java.lang.Object[] items)
self
- an Object with an Iterator returning its valuesclosure
- a closure condition
public static void addShutdownHook(java.lang.Object self, Closure closure)
public static java.lang.Number and(java.lang.Number left, java.lang.Number right)
public static java.util.BitSet and(java.util.BitSet left, java.util.BitSet right)
public static java.lang.Boolean and(java.lang.Boolean left, java.lang.Boolean right)
self
- the iteration object over which to iteratestartIndex
- start matching from this indexclosure
- the filter to perform a match on the collection
public static boolean any(java.lang.Object self, Closure closure)
public static boolean any(java.util.Map self, Closure closure)
public static boolean any(java.lang.Object self)
@java.lang.Deprecatedpublic static BufferedReader newReader(InputStream self) { public static void append(java.io.File file, java.lang.Object text)
@java.lang.Deprecatedpublic static BufferedReader newReader(InputStream self, String charset) throws UnsupportedEncodingException { public static void append(java.io.File file, byte[] bytes)
@java.lang.Deprecatedpublic staticT withReader(File file, Closure closure) throws IOException { public static void append(java.io.File self, java.io.InputStream stream)
@java.lang.Deprecatedpublic staticT withReader(File file, String charset, Closure closure) throws IOException { public static void append(java.io.File file, java.lang.Object text, java.lang.String charset)
public static boolean asBoolean(java.lang.Object object)
public static boolean asBoolean(java.lang.Boolean bool)
public static boolean asBoolean(java.util.Collection collection)
public static boolean asBoolean(java.util.Map map)
public static boolean asBoolean(java.util.Iterator iterator)
public static boolean asBoolean(java.util.Enumeration enumeration)
public static boolean asBoolean(java.lang.Object[] array)
public static boolean asBoolean(byte[] array)
public static boolean asBoolean(short[] array)
public static boolean asBoolean(int[] array)
public static boolean asBoolean(long[] array)
public static boolean asBoolean(float[] array)
public static boolean asBoolean(double[] array)
public static boolean asBoolean(boolean[] array)
public static boolean asBoolean(char[] array)
public static boolean asBoolean(java.lang.Character character)
public static boolean asBoolean(java.lang.Number number)
@java.lang.Deprecated} public static boolean asBoolean(java.lang.CharSequence string)
@java.lang.Deprecated} public static boolean asBoolean(java.util.regex.Matcher matcher)
public static java.util.Map asImmutable(java.util.Map self)
self
- a List
public static java.util.SortedMap asImmutable(java.util.SortedMap self)
public static java.util.List asImmutable(java.util.List self)
public static java.util.Set asImmutable(java.util.Set self)
public static java.util.SortedSet asImmutable(java.util.SortedSet self)
public static java.util.Collection asImmutable(java.util.Collection self)
self
- a SortedMap
@java.lang.Deprecated*/ public static java.util.List asList(java.util.Collection self)
public static java.util.List asList(java.lang.Iterable self)
bool
- the Boolean
public static java.util.Map asSynchronized(java.util.Map self)
public static java.util.SortedMap asSynchronized(java.util.SortedMap self)
public static java.util.Collection asSynchronized(java.util.Collection self)
public static java.util.List asSynchronized(java.util.List self)
public static java.util.Set asSynchronized(java.util.Set self)
public static java.util.SortedSet asSynchronized(java.util.SortedSet self)
@java.lang.SuppressWarnings} public static java.lang.Object asType(java.util.Collection col, java.lang.Class clazz)
@java.lang.SuppressWarnings} catch (GroovyCastException ce) { public static java.lang.Object asType(java.lang.Object[] ary, java.lang.Class clazz)
ary
- an arrayclazz
- the desired class
@java.lang.SuppressWarningsnew Class[]{clazz}, public static java.lang.Object asType(Closure cl, java.lang.Class clazz)
map
- this mapclazz
- the target type
@java.lang.SuppressWarningsreturn reverse(self, false); public static java.lang.Object asType(java.util.Map map, java.lang.Class clazz)
def list = ["a", 4, false] assert list.reverse() == [false, 4, "a"] assert list == ["a", 4, false]
self
- a List
@java.lang.SuppressWarnings* @param closure a closure public static java.lang.Object asType(java.lang.Number self, java.lang.Class c)
self
- a Byte arrayclosure
- a closure
@java.lang.SuppressWarningselse { public static java.lang.Object asType(java.lang.Object obj, java.lang.Class type)
String.metaClass.myMethod = { println "foo" }
c
- The java.lang.Class instance
@java.lang.Deprecated} public static java.lang.Object asType(java.lang.CharSequence self, java.lang.Class c)
@java.lang.Deprecated} @java.lang.SuppressWarnings public static java.lang.Object asType(GString self, java.lang.Class c)
@java.lang.Deprecated @java.lang.SuppressWarnings@Deprecated public static java.lang.Object asType(java.lang.String self, java.lang.Class c)
@java.lang.Deprecatedreturn ResourceGroovyMethods.withPrintWriter(file, charset, closure); public static java.lang.Object asType(java.io.File f, java.lang.Class c)
@java.lang.Deprecatedreturn ResourceGroovyMethods.withPrintWriter(file, closure); public static java.io.File asWritable(java.io.File file)
@java.lang.Deprecatedreturn IOGroovyMethods.withPrintWriter(writer, closure); public static java.io.File asWritable(java.io.File file, java.lang.String encoding)
public static java.util.BitSet bitwiseNegate(java.util.BitSet self)
self
- a longto
- the end numberclosure
- the code to execute for each number
@java.lang.Deprecated public static java.util.regex.Pattern bitwiseNegate(java.lang.CharSequence self)
@java.lang.Deprecated public static java.util.regex.Pattern bitwiseNegate(java.lang.String self)
protected static java.lang.Object callClosureForLine(Closure closure, java.lang.String line, int counter)
protected static java.lang.Object callClosureForMapEntry(Closure closure, java.util.Map$Entry entry)
protected static java.lang.Object callClosureForMapEntryAndCounter(Closure closure, java.util.Map$Entry entry, int counter)
@java.lang.Deprecated public static java.lang.CharSequence capitalize(java.lang.CharSequence self)
@java.lang.Deprecated public static java.lang.String capitalize(java.lang.String self)
@java.lang.Deprecated public static java.lang.CharSequence center(java.lang.CharSequence self, java.lang.Number numberOfChars)
@java.lang.Deprecated public static java.lang.CharSequence center(java.lang.CharSequence self, java.lang.Number numberOfChars, java.lang.CharSequence padding)
@java.lang.Deprecated public static java.lang.String center(java.lang.String self, java.lang.Number numberOfChars)
@java.lang.Deprecated public static java.lang.String center(java.lang.String self, java.lang.Number numberOfChars, java.lang.String padding)
public static java.util.List collate(java.util.List self, int size)
public static java.util.List collate(java.util.List self, int size, int step)
public static java.util.List collate(java.util.List self, int size, boolean keepRemainder)
public static java.util.List collate(java.util.List self, int size, int step, boolean keepRemainder)
public static java.util.List collect(java.lang.Object self, Closure transform)
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]
self
- an aggregate Object with an Iterator returning its itemstransform
- the closure used to transform each item of the aggregate object
public static java.util.Collection collect(java.lang.Object self)
transform
closure
and adding it to the supplied collector
.
self
- an aggregate Object with an Iterator returning its itemscollector
- the Collection to which the transformed values are addedtransform
- the closure used to transform each item of the aggregate object
public static java.util.Collection collect(java.lang.Object self, java.util.Collection collector, Closure transform)
public static java.util.List collect(java.util.Collection self, Closure transform)
assert [1,2,3] == [1,2,3].collect()
self
- a collection
public static java.util.List collect(java.util.Collection self)
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) }
self
- a collectioncollector
- the Collection to which the transformed values are addedtransform
- the closure used to transform each item of the collection
public static java.util.Collection collect(java.util.Collection self, java.util.Collection collector, Closure transform)
public static java.util.Collection collect(java.util.Map self, java.util.Collection collector, Closure transform)
public static java.util.List collect(java.util.Map self, Closure transform)
public static java.util.List collectAll(java.util.Collection self, Closure transform)
public static java.util.Collection collectAll(java.util.Collection self, java.util.Collection collector, Closure transform)
public static java.util.Map collectEntries(java.util.Map self, java.util.Map collector, Closure transform)
public static java.util.Map collectEntries(java.util.Map self, Closure transform)
@java.lang.Deprecatedpublic staticMap collectEntries(Iterator> self, Closure> transform) { public static java.util.Map collectEntries(java.util.Collection self, Closure transform)
public static java.util.Map collectEntries(java.util.Iterator self, Closure transform)
public static java.util.Map collectEntries(java.lang.Iterable self, Closure transform)
@java.lang.Deprecated} public static java.util.Map collectEntries(java.util.Collection self)
public static java.util.Map collectEntries(java.util.Iterator self)
public static java.util.Map collectEntries(java.lang.Iterable self)
@java.lang.Deprecatedpublic staticMap collectEntries(Iterator> self, Map collector, Closure> transform) { public static java.util.Map collectEntries(java.util.Collection self, java.util.Map collector, Closure transform)
public static java.util.Map collectEntries(java.util.Iterator self, java.util.Map collector, Closure transform)
public static java.util.Map collectEntries(java.lang.Iterable self, java.util.Map collector, Closure transform)
@java.lang.Deprecatedpublic staticMap collectEntries(Iterator> self, Map collector) { public static java.util.Map collectEntries(java.util.Collection self, java.util.Map collector)
public static java.util.Map collectEntries(java.util.Iterator self, java.util.Map collector)
self
- an Iterablecollector
- the Map into which the transformed entries are put
public static java.util.Map collectEntries(java.lang.Iterable self, java.util.Map collector)
public static java.util.Map collectEntries(java.lang.Object[] self, java.util.Map collector, Closure transform)
self
- an Object arraycollector
- the Map into which the transformed entries are put
public static java.util.Map collectEntries(java.lang.Object[] self, java.util.Map collector)
public static java.util.Map collectEntries(java.lang.Object[] self, Closure transform)
self
- an Object array
public static java.util.Map collectEntries(java.lang.Object[] self)
@java.lang.Deprecated/** public static java.util.List collectMany(java.util.Collection self, Closure projection)
@java.lang.Deprecated* assert smallAnimals == ['cat', 'dog'] public static java.util.Collection collectMany(java.util.Collection self, java.util.Collection collector, Closure projection)
public static java.util.List collectMany(java.lang.Iterable self, Closure projection)
public static java.util.Collection collectMany(java.lang.Iterable self, java.util.Collection collector, Closure projection)
public static java.util.Collection collectMany(java.util.Map self, java.util.Collection collector, Closure projection)
public static java.util.Collection collectMany(java.util.Map self, Closure projection)
public static java.util.List collectMany(java.lang.Object[] self, Closure projection)
public static java.util.List collectMany(java.util.Iterator self, Closure projection)
public static java.util.List collectNested(java.util.Collection self, Closure transform)
public static java.util.List collectNested(java.lang.Iterable self, Closure transform)
@java.lang.Deprecated* @param self an Iterable public static java.util.Collection collectNested(java.util.Collection self, java.util.Collection collector, Closure transform)
public static java.util.Collection collectNested(java.lang.Iterable self, java.util.Collection collector, Closure transform)
@java.lang.Deprecatedpublic static List combinations(Iterable self) { public static java.util.List combinations(java.util.Collection self)
Example usage:
assert [['a', 'b'],[1, 2, 3]].combinations() == [['a', 1], ['b', 1], ['a', 2], ['b', 2], ['a', 3], ['b', 3]]
self
- an Iterable of collections
public static java.util.List combinations(java.lang.Iterable self)
Example usage:
assert [[2, 3],[4, 5, 6]].combinations {x,y -> x*y } == [8, 12, 10, 15, 12, 18]
self
- a Collection of listsfunction
- a closure to be called on each combination
public static java.util.List combinations(java.lang.Iterable self, Closure function)
Example usage:
[[2, 3],[4, 5, 6]].eachCombination { println "Found $it" }
self
- a Collection of listsfunction
- a closure to be called on each combination
public static int compareTo(java.lang.Character left, java.lang.Number right)
left
- a Numberright
- a Character
public static int compareTo(java.lang.Number left, java.lang.Character right)
left
- a Characterright
- another Character
public static int compareTo(java.lang.Character left, java.lang.Character right)
public static int compareTo(java.lang.Number left, java.lang.Number right)
public static boolean contains(int[] self, java.lang.Object value)
public static boolean contains(long[] self, java.lang.Object value)
self
- the array we are searchingvalue
- the value being searched for
public static boolean contains(short[] self, java.lang.Object value)
self
- an array
public static boolean contains(char[] self, java.lang.Object value)
self
- an array
public static boolean contains(boolean[] self, java.lang.Object value)
self
- an array
public static boolean contains(double[] self, java.lang.Object value)
self
- an array
public static boolean contains(float[] self, java.lang.Object value)
self
- an array
public static boolean contains(byte[] self, java.lang.Object value)
self
- an array
public static boolean contains(java.lang.Object[] self, java.lang.Object value)
@java.lang.Deprecated public static boolean contains(java.lang.CharSequence self, java.lang.CharSequence text)
@java.lang.Deprecated public static boolean contains(java.lang.String self, java.lang.String text)
public static boolean containsAll(java.util.Collection self, java.lang.Object[] items)
findAll
and grep
when wanting to produce a new list
containing items which don't match some criteria while leaving the original collection unchanged.
self
- a Collection to be modifieditems
- array containing elements to be removed from this collection
public static java.lang.Number count(java.util.Iterator self, java.lang.Object value)
public static java.lang.Number count(java.util.Iterator self, Closure closure)
Example usage:
assert [2,4,2,1,3,5,2,4,3].toSet().iterator().count{ it % 2 == 0 } == 2
self
- the Iterator from which we count the number of matching occurrencesclosure
- a closure condition
@java.lang.Deprecated* @param value the value being searched for public static java.lang.Number count(java.util.Collection self, java.lang.Object value)
public static java.lang.Number count(java.lang.Iterable self, java.lang.Object value)
@java.lang.Deprecated* @since 2.2.0 public static java.lang.Number count(java.util.Collection self, Closure closure)
public static java.lang.Number count(java.lang.Iterable self, Closure closure)
public static java.lang.Number count(java.util.Map self, Closure closure)
public static java.lang.Number count(java.lang.Object[] self, java.lang.Object value)
compareTo(value) == 0
or equals(value)
).
self
- the array within which we count the number of occurrencesvalue
- the value being searched for
public static java.lang.Number count(java.lang.Object[] self, Closure closure)
compareTo(value) == 0
or equals(value)
).
self
- the array within which we count the number of occurrencesvalue
- the value being searched for
public static java.lang.Number count(int[] self, java.lang.Object value)
compareTo(value) == 0
or equals(value)
).
self
- the array within which we count the number of occurrencesvalue
- the value being searched for
public static java.lang.Number count(long[] self, java.lang.Object value)
compareTo(value) == 0
or equals(value)
).
self
- the array within which we count the number of occurrencesvalue
- the value being searched for
public static java.lang.Number count(short[] self, java.lang.Object value)
compareTo(value) == 0
or equals(value)
).
self
- the array within which we count the number of occurrencesvalue
- the value being searched for
public static java.lang.Number count(char[] self, java.lang.Object value)
compareTo(value) == 0
or equals(value)
).
self
- the array within which we count the number of occurrencesvalue
- the value being searched for
public static java.lang.Number count(boolean[] self, java.lang.Object value)
compareTo(value) == 0
or equals(value)
).
self
- the array within which we count the number of occurrencesvalue
- the value being searched for
public static java.lang.Number count(double[] self, java.lang.Object value)
compareTo(value) == 0
or equals(value)
).
self
- the array within which we count the number of occurrencesvalue
- the value being searched for
public static java.lang.Number count(float[] self, java.lang.Object value)
compareTo(value) == 0
or equals(value)
).
self
- the array within which we count the number of occurrencesvalue
- the value being searched for
public static java.lang.Number count(byte[] self, java.lang.Object value)
@java.lang.Deprecated public static int count(java.lang.CharSequence self, java.lang.CharSequence text)
@java.lang.Deprecated public static int count(java.lang.String self, java.lang.String text)
@java.lang.Deprecatedpublic staticMap countBy(Iterable self, Closure closure) { public static java.util.Map countBy(java.util.Collection self, Closure closure)
public static java.util.Map countBy(java.lang.Iterable self, Closure closure)
Example usage:
assert ([1,2,2,2,3] as Object[]).countBy{ it % 2 } == [1:2, 0:3]
self
- an object array to group and countclosure
- a closure mapping items to the frequency keys
public static java.util.Map countBy(java.lang.Object[] self, Closure closure)
Example usage:
assert [1,2,2,2,3].toSet().iterator().countBy{ it % 2 } == [1:2, 0:1]
self
- an iterator to group and countclosure
- a closure mapping items to the frequency keys
public static java.util.Map countBy(java.util.Iterator self, Closure closure)
public static java.util.Map countBy(java.util.Map self, Closure closure)
answer
- the map containing the resultselement
- the element to be placedvalue
- the value according to which the element will be placed
@java.lang.Deprecated protected static StringBufferWriter createStringBufferWriter(java.lang.StringBuffer self)
@java.lang.Deprecated protected static java.io.StringWriter createStringWriter(java.lang.String self)
@java.lang.Deprecatedreturn ResourceGroovyMethods.withWriterAppend(file, charset, closure); public static boolean deleteDir(java.io.File self)
@java.lang.Deprecatedreturn StringGroovyMethods.findAll(self, pattern); public static java.lang.CharSequence denormalize(java.lang.CharSequence self)
@java.lang.Deprecatedreturn StringGroovyMethods.findAll(self, pattern, closure); public static java.lang.String denormalize(java.lang.String self)
public static boolean disjoint(java.util.Collection left, java.util.Collection right)
left
- an int arrayright
- the array being compared
public static java.lang.Number div(java.lang.Character left, java.lang.Number right)
left
- a Numberright
- another Number to bitwise AND
public static java.lang.Number div(java.lang.Number left, java.lang.Character right)
public static java.lang.Number div(java.lang.Character left, java.lang.Character right)
public static void downto(java.lang.Number self, java.lang.Number to, Closure closure)
self
- a doubleto
- the end numberclosure
- the code to execute for each number
public static void downto(long self, java.lang.Number to, Closure closure)
self
- a BigIntegerto
- the end numberclosure
- the code to execute for each number
public static void downto(java.lang.Long self, java.lang.Number to, Closure closure)
public static void downto(float self, java.lang.Number to, Closure closure)
public static void downto(java.lang.Float self, java.lang.Number to, Closure closure)
public static void downto(double self, java.lang.Number to, Closure closure)
public static void downto(java.lang.Double self, java.lang.Number to, Closure closure)
public static void downto(java.math.BigInteger self, java.lang.Number to, Closure closure)
public static void downto(java.math.BigDecimal self, java.lang.Number to, Closure closure)
number
- a Number
public static java.util.List drop(java.util.List self, int num)
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) == []
self
- the original Iterablenum
- the number of elements to drop from this Iterablenum
elements,
or an empty list if it has less then num
elements.
public static java.util.List drop(java.lang.Iterable self, int num)
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[]
self
- the original arraynum
- the number of elements to drop from this arraynum
ones, or else the empty array, if this
array has less than num
elements.
public static java.lang.Object[] drop(java.lang.Object[] self, int num)
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.
self
- the original mapnum
- the number of elements to drop from this mapnum
ones, or else the empty map, if this map has
less than num
elements.
public static java.util.Map drop(java.util.Map self, int num)
public static java.util.Iterator drop(java.util.Iterator self, int num)
def nums = [ 1, 3, 2 ] assert nums.takeWhile{ it < 1 } == [] assert nums.takeWhile{ it < 3 } == [ 1 ] assert nums.takeWhile{ it < 4 } == [ 1, 3, 2 ]
self
- the original listcondition
- the closure that must evaluate to true to
continue taking elements
@java.lang.Deprecatedreturn StringGroovyMethods.findAll(self, pattern); public static java.lang.CharSequence drop(java.lang.CharSequence self, int num)
public static java.util.List dropWhile(java.util.List self, Closure condition)
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']
self
- an Iterablecondition
- the closure that must evaluate to true to continue dropping elements
public static java.util.List dropWhile(java.lang.Iterable self, Closure condition)
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 drop random entries. Groovy by default uses LinkedHashMap, so this shouldn't be an issue in the main.
self
- a Mapcondition
- a 1 (or 2) arg Closure that must evaluate to true for the
entry (or key and value) to continue dropping elements
public static java.util.Map dropWhile(java.util.Map self, Closure condition)
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[]
self
- the original arraycondition
- the closure that must evaluate to true to
continue dropping elements
public static java.lang.Object[] dropWhile(java.lang.Object[] self, Closure condition)
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 ]
self
- the Iteratorcondition
- the closure that must evaluate to true to continue dropping elements
public static java.util.Iterator dropWhile(java.util.Iterator self, Closure condition)
public static java.lang.String dump(java.lang.Object self)
public static java.lang.Object each(java.lang.Object self, Closure closure)
self
- the object over which we iterateclosure
- the closure applied on each element found
public static java.util.Map each(java.util.Map self, Closure closure)
public static void eachByte(java.lang.Byte[] self, Closure closure)
public static void eachByte(byte[] self, Closure closure)
@java.lang.Deprecated public static void eachByte(java.io.File self, Closure closure)
@java.lang.Deprecated public static void eachByte(java.io.File self, int bufferLen, Closure closure)
@java.lang.Deprecated public static void eachByte(java.io.InputStream is, Closure closure)
@java.lang.Deprecated public static void eachByte(java.io.InputStream is, int bufferLen, Closure closure)
@java.lang.Deprecated public static void eachByte(java.net.URL url, Closure closure)
@java.lang.Deprecated public static void eachByte(java.net.URL url, int bufferLen, Closure closure)
public static void eachCombination(java.lang.Iterable self, Closure function)
Example usage:
def result = [1, 2, 3].subsequences() assert result == [[1, 2, 3], [1, 3], [2, 3], [1, 2], [1], [2], [3]] as Set
self
- the List of items
@java.lang.Deprecatedreturn ResourceGroovyMethods.withOutputStream(file, closure); public static void eachDir(java.io.File self, Closure closure)
@java.lang.Deprecatedreturn ResourceGroovyMethods.withWriter(file, charset, closure); public static void eachDirMatch(java.io.File self, java.lang.Object nameFilter, Closure closure)
@java.lang.Deprecated public static void eachDirRecurse(java.io.File self, Closure closure)
@java.lang.Deprecatedpublic static BufferedOutputStream newOutputStream(File file) throws IOException { public static void eachFile(java.io.File self, FileType fileType, Closure closure)
@java.lang.Deprecatedreturn ResourceGroovyMethods.newDataOutputStream(file); public static void eachFile(java.io.File self, Closure closure)
@java.lang.Deprecated public static void eachFileMatch(java.io.File self, FileType fileType, java.lang.Object nameFilter, Closure closure)
@java.lang.Deprecatedpublic staticT withWriter(File file, Closure closure) throws IOException { public static void eachFileMatch(java.io.File self, java.lang.Object nameFilter, Closure closure)
@java.lang.Deprecatedreturn ResourceGroovyMethods.withInputStream(file, closure); public static void eachFileRecurse(java.io.File self, FileType fileType, Closure closure)
@java.lang.Deprecated public static void eachFileRecurse(java.io.File self, Closure closure)
@java.lang.Deprecated} public static java.lang.Object eachLine(java.lang.CharSequence self, Closure closure)
@java.lang.Deprecated} public static java.lang.Object eachLine(java.lang.CharSequence self, int firstLine, Closure closure)
@java.lang.Deprecated} public static java.lang.Object eachLine(java.lang.String self, Closure closure)
@java.lang.Deprecated} public static java.lang.Object eachLine(java.lang.String self, int firstLine, Closure closure)
@java.lang.Deprecated} public static java.lang.Object eachLine(java.io.File self, Closure closure)
@java.lang.Deprecated} public static java.lang.Object eachLine(java.io.File self, java.lang.String charset, Closure closure)
@java.lang.Deprecated} public static java.lang.Object eachLine(java.io.File self, int firstLine, Closure closure)
@java.lang.Deprecated} public static java.lang.Object eachLine(java.io.File self, java.lang.String charset, int firstLine, Closure closure)
@java.lang.Deprecated} public static java.lang.Object eachLine(java.io.InputStream stream, java.lang.String charset, Closure closure)
@java.lang.Deprecated} public static java.lang.Object eachLine(java.io.InputStream stream, java.lang.String charset, int firstLine, Closure closure)
@java.lang.Deprecated} public static java.lang.Object eachLine(java.io.InputStream stream, Closure closure)
@java.lang.Deprecated} public static java.lang.Object eachLine(java.io.InputStream stream, int firstLine, Closure closure)
@java.lang.Deprecated} public static java.lang.Object eachLine(java.net.URL url, Closure closure)
@java.lang.Deprecated} public static java.lang.Object eachLine(java.net.URL url, int firstLine, Closure closure)
@java.lang.Deprecated} public static java.lang.Object eachLine(java.net.URL url, java.lang.String charset, Closure closure)
@java.lang.Deprecated} public static java.lang.Object eachLine(java.net.URL url, java.lang.String charset, int firstLine, Closure closure)
@java.lang.Deprecated} public static java.lang.Object eachLine(java.io.Reader self, Closure closure)
@java.lang.Deprecated} public static java.lang.Object eachLine(java.io.Reader self, int firstLine, Closure closure)
@java.lang.Deprecated} public static java.lang.String eachMatch(java.lang.CharSequence self, java.lang.CharSequence regex, Closure closure)
@java.lang.Deprecated} public static java.lang.String eachMatch(java.lang.CharSequence self, java.util.regex.Pattern pattern, Closure closure)
@java.lang.Deprecated} public static java.lang.String eachMatch(java.lang.String self, java.util.regex.Pattern pattern, Closure closure)
@java.lang.Deprecated} public static java.lang.String eachMatch(java.lang.String self, java.lang.String regex, Closure closure)
@java.lang.Deprecated} public static void eachObject(java.io.File self, Closure closure)
@java.lang.Deprecated} public static void eachObject(java.io.ObjectInputStream ois, Closure closure)
public static java.util.Iterator eachPermutation(java.util.Collection self, Closure closure)
public static java.lang.Object eachWithIndex(java.lang.Object self, Closure closure)
public static java.util.Map eachWithIndex(java.util.Map self, Closure closure)
public static boolean equals(int[] left, int[] right)
false
if either collection is null
.
left
- an arrayright
- the List being compared
public static boolean equals(java.lang.Object[] left, java.util.List right)
public static boolean equals(java.util.List left, java.lang.Object[] right)
public static boolean equals(java.util.List left, java.util.List right)
public static boolean equals(java.util.Set self, java.util.Set other)
public static boolean equals(java.util.Map self, java.util.Map other)
self
- a Set objectremoveMe
- the items to remove from the Set
public static boolean every(java.lang.Object self, Closure closure)
public static boolean every(java.util.Map self, Closure closure)
public static boolean every(java.lang.Object self)
@java.lang.Deprecatedreturn IOGroovyMethods.newObjectInputStream(inputStream); public static java.lang.Process execute(java.lang.String self)
@java.lang.Deprecatedreturn IOGroovyMethods.newObjectInputStream(inputStream, classLoader); public static java.lang.Process execute(java.lang.String self, java.lang.String[] envp, java.io.File dir)
@java.lang.Deprecatedreturn ResourceGroovyMethods.newObjectInputStream(file, classLoader); public static java.lang.Process execute(java.lang.String self, java.util.List envp, java.io.File dir)
@java.lang.DeprecatedResourceGroovyMethods.eachObject(self, closure); public static java.lang.Process execute(java.lang.String[] commandArray)
@java.lang.DeprecatedIOGroovyMethods.eachObject(ois, closure); public static java.lang.Process execute(java.lang.String[] commandArray, java.lang.String[] envp, java.io.File dir)
@java.lang.Deprecatedreturn ResourceGroovyMethods.withObjectInputStream(file, closure); public static java.lang.Process execute(java.lang.String[] commandArray, java.util.List envp, java.io.File dir)
@java.lang.Deprecatedreturn ResourceGroovyMethods.withObjectInputStream(file, classLoader, closure); public static java.lang.Process execute(java.util.List commands)
@java.lang.Deprecatedreturn IOGroovyMethods.withObjectInputStream(inputStream, closure); public static java.lang.Process execute(java.util.List commands, java.lang.String[] envp, java.io.File dir)
@java.lang.Deprecatedreturn IOGroovyMethods.withObjectInputStream(inputStream, classLoader, closure); public static java.lang.Process execute(java.util.List commands, java.util.List envp, java.io.File dir)
@java.lang.Deprecated} public static java.lang.CharSequence expand(java.lang.CharSequence self)
@java.lang.Deprecated} public static java.lang.CharSequence expand(java.lang.CharSequence self, int tabStop)
@java.lang.Deprecated} public static java.lang.String expand(java.lang.String self)
@java.lang.Deprecated} public static java.lang.String expand(java.lang.String self, int tabStop)
@java.lang.Deprecated} public static java.lang.CharSequence expandLine(java.lang.CharSequence self, int tabStop)
@java.lang.Deprecated} public static java.lang.String expandLine(java.lang.String self, int tabStop)
@java.lang.Deprecated public static void filterLine(java.io.Reader reader, java.io.Writer writer, Closure closure)
@java.lang.Deprecated public static Writable filterLine(java.io.File self, Closure closure)
@java.lang.Deprecated public static Writable filterLine(java.io.File self, java.lang.String charset, Closure closure)
@java.lang.Deprecated public static void filterLine(java.io.File self, java.io.Writer writer, Closure closure)
@java.lang.Deprecated public static void filterLine(java.io.File self, java.io.Writer writer, java.lang.String charset, Closure closure)
@java.lang.Deprecated public static Writable filterLine(java.io.Reader reader, Closure closure)
@java.lang.Deprecated public static Writable filterLine(java.io.InputStream self, Closure predicate)
@java.lang.Deprecated public static Writable filterLine(java.io.InputStream self, java.lang.String charset, Closure predicate)
@java.lang.Deprecated public static void filterLine(java.io.InputStream self, java.io.Writer writer, Closure predicate)
@java.lang.Deprecated public static void filterLine(java.io.InputStream self, java.io.Writer writer, java.lang.String charset, Closure predicate)
@java.lang.Deprecated public static Writable filterLine(java.net.URL self, Closure predicate)
@java.lang.Deprecated public static Writable filterLine(java.net.URL self, java.lang.String charset, Closure predicate)
@java.lang.Deprecated public static void filterLine(java.net.URL self, java.io.Writer writer, Closure predicate)
@java.lang.Deprecated public static void filterLine(java.net.URL self, java.io.Writer writer, java.lang.String charset, Closure predicate)
public static java.lang.Object find(java.lang.Object self, Closure closure)
public static java.lang.Object find(java.lang.Object self)
self
- an Object with an iterator returning its valuesdefaultResult
- an Object that should be returned if all closure results are nullclosure
- a closure that returns a non-null value when processing should stop
public static java.lang.Object find(java.util.Collection self, Closure closure)
public static java.lang.Object find(java.lang.Object[] self, Closure condition)
public static java.lang.Object find(java.util.Collection self)
public static java.util.Map$Entry find(java.util.Map self, Closure closure)
@java.lang.Deprecated} public static java.lang.CharSequence find(java.lang.CharSequence self, java.lang.CharSequence regex)
@java.lang.Deprecated} public static java.lang.CharSequence find(java.lang.CharSequence self, java.lang.CharSequence regex, Closure closure)
@java.lang.Deprecated} public static java.lang.CharSequence find(java.lang.CharSequence self, java.util.regex.Pattern pattern)
@java.lang.Deprecated} public static java.lang.CharSequence find(java.lang.CharSequence self, java.util.regex.Pattern pattern, Closure closure)
@java.lang.Deprecated} public static java.lang.String find(java.lang.String self, java.util.regex.Pattern pattern)
@java.lang.Deprecated} public static java.lang.String find(java.lang.String self, java.util.regex.Pattern pattern, Closure closure)
@java.lang.Deprecated} public static java.lang.String find(java.lang.String self, java.lang.String regex)
@java.lang.Deprecated} public static java.lang.String find(java.lang.String self, java.lang.String regex, Closure closure)
public static java.util.Collection findAll(java.util.Collection self, Closure closure)
def items = [1,2,3,4] as Integer[] assert [2,4] == items.findAll { it % 2 == 0 }
self
- an arraycondition
- a closure condition
public static java.util.Collection findAll(java.lang.Object[] self, Closure condition)
public static java.util.Collection findAll(java.util.Collection self)
Example:
def items = [1, 2, 0, false, true, '', 'foo', [], [4, 5], null] as Object[] assert items.findAll() == [1, 2, true, 'foo', [4, 5]]
self
- an array
public static java.util.Collection findAll(java.lang.Object[] self)
self
- an Object with an Iterator returning its valuesclosure
- a closure condition
public static java.util.Collection findAll(java.lang.Object self, Closure closure)
public static java.util.Collection findAll(java.lang.Object self)
public static java.util.Map findAll(java.util.Map self, Closure closure)
@java.lang.Deprecated} public static java.util.List findAll(java.lang.CharSequence self, java.lang.CharSequence regex)
@java.lang.Deprecated} public static java.util.List findAll(java.lang.CharSequence self, java.lang.CharSequence regex, Closure closure)
@java.lang.Deprecated} public static java.util.List findAll(java.lang.CharSequence self, java.util.regex.Pattern pattern)
@java.lang.Deprecated} public static java.util.List findAll(java.lang.CharSequence self, java.util.regex.Pattern pattern, Closure closure)
@java.lang.Deprecated} public static java.util.List findAll(java.lang.String self, java.util.regex.Pattern pattern)
@java.lang.Deprecated} public static java.util.List findAll(java.lang.String self, java.util.regex.Pattern pattern, Closure closure)
@java.lang.Deprecated} public static java.util.List findAll(java.lang.String self, java.lang.String regex)
@java.lang.Deprecated} public static java.util.List findAll(java.lang.String self, java.lang.String regex, Closure closure)
public static int findIndexOf(java.lang.Object self, Closure closure)
public static int findIndexOf(java.lang.Object self, int startIndex, Closure closure)
public static java.util.List findIndexValues(java.lang.Object self, Closure closure)
public static java.util.List findIndexValues(java.lang.Object self, java.lang.Number startIndex, Closure closure)
public static int findLastIndexOf(java.lang.Object self, Closure closure)
public static int findLastIndexOf(java.lang.Object self, int startIndex, Closure closure)
public static java.lang.Object findResult(java.lang.Object self, java.lang.Object defaultResult, Closure closure)
self
- an Object with an iterator returning its valuesclosure
- a closure that returns a non-null value when processing should stop
public static java.lang.Object findResult(java.lang.Object self, Closure closure)
public static java.lang.Object findResult(java.util.Collection self, java.lang.Object defaultResult, Closure closure)
public static java.lang.Object findResult(java.util.Collection self, Closure closure)
public static java.lang.Object findResult(java.util.Map self, java.lang.Object defaultResult, Closure closure)
public static java.lang.Object findResult(java.util.Map self, Closure closure)
@java.lang.Deprecated* @return the list of non-null transformed values public static java.util.Collection findResults(java.util.Collection self, Closure filteringTransform)
public static java.util.Collection findResults(java.lang.Iterable self, Closure filteringTransform)
public static java.util.Collection findResults(java.util.Map self, Closure filteringTransform)
public static java.lang.Object first(java.util.List self)
public static java.lang.Object first(java.lang.Iterable self)
public static java.lang.Object first(java.lang.Object[] self)
def array = [3, 4, 2].toArray() assert array.head() == 3
self
- an Object array
public static java.util.Collection flatten(java.util.Collection self)
self
- a boolean Array to flatten
public static java.util.Collection flatten(java.lang.Iterable self)
public static java.util.Collection flatten(java.lang.Object[] self)
public static java.util.Collection flatten(boolean[] self)
public static java.util.Collection flatten(byte[] self)
public static java.util.Collection flatten(char[] self)
public static java.util.Collection flatten(short[] self)
public static java.util.Collection flatten(int[] self)
public static java.util.Collection flatten(long[] self)
public static java.util.Collection flatten(float[] self)
public static java.util.Collection flatten(double[] self)
public static java.util.Collection flatten(java.util.Collection self, Closure flattenUsing)
public static java.util.Collection flatten(java.lang.Iterable self, Closure flattenUsing)
public static java.lang.Object get(java.util.Map map, java.lang.Object key, java.lang.Object defaultValue)
array
- an Array of Objectsrange
- a Range
public static java.lang.Object getAt(java.lang.Object self, java.lang.String property)
bean[somePropertyNameExpression]
. The normal property notation
of groovy is neater and more concise but only works with compile-time known
property names.
self
- the object to act uponproperty
- the property name of interest
public static java.util.List getAt(java.util.List self, Range range)
def list = [].withDefault { 42 } assert list[1,0,2] == [42, 42, 42]
self
- a ListWithDefaultindices
- a Collection of indices
public static java.util.List getAt(ListWithDefault self, java.util.Collection indices)
def list = [].withDefault { 42 } assert list[1..2] == [null, 42]
self
- a ListWithDefaultrange
- a Range indicating the items to get
public static java.util.List getAt(ListWithDefault self, Range range)
public static java.util.List getAt(ListWithDefault self, EmptyRange range)
def list = [true, 1, 3.4] assert list[0..<0] == []
self
- a Listrange
- a Range indicating the items to get
public static java.util.List getAt(java.util.List self, EmptyRange range)
public static java.util.List getAt(java.util.List self, java.util.Collection indices)
self
- an Array of Objectsindices
- a Collection of indices
public static java.util.List getAt(java.lang.Object[] self, java.util.Collection indices)
assert [1:10, 2:20, 4:40].subMap( [2, 4] ) == [2:20, 4:40]
map
- a Mapkeys
- a Collection of keys
public static java.util.List getAt(java.lang.Object[] array, Range range)
array
- an Array of Objectsrange
- an EmptyRange
public static java.util.List getAt(java.lang.Object[] array, IntRange range)
array
- an Array of Objectsrange
- an ObjectRange
public static java.util.List getAt(java.lang.Object[] array, EmptyRange range)
array
- an Array of Objects
public static java.util.List getAt(java.lang.Object[] array, ObjectRange range)
public static java.lang.Object getAt(java.util.List self, int idx)
public static java.lang.Object getAt(java.util.Iterator self, int idx)
public static java.lang.Object getAt(java.lang.Iterable self, int idx)
def list = [2, 3] list[0] = 1 assert list == [1, 3]
self
- a Listidx
- an indexvalue
- the value to put at the given index
public static java.lang.Object getAt(java.util.Map self, java.lang.Object key)
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]
left
- a Mapright
- a Map
public static java.util.List getAt(java.util.Collection coll, java.lang.String property)
self
- a Map
@java.lang.SuppressWarnings* @param range a range indicating the indices for the items to retrieve public static java.util.List getAt(byte[] array, Range range)
array
- an int arrayrange
- a range indicating the indices for the items to retrieve
@java.lang.SuppressWarnings* @param range a range indicating the indices for the items to retrieve public static java.util.List getAt(char[] array, Range range)
@java.lang.SuppressWarnings* @param range a range indicating the indices for the items to retrieve public static java.util.List getAt(short[] array, Range range)
@java.lang.SuppressWarnings* @param range a range indicating the indices for the items to retrieve public static java.util.List getAt(int[] array, Range range)
@java.lang.SuppressWarnings* @param range an IntRange indicating the indices for the items to retrieve public static java.util.List getAt(long[] array, Range range)
@java.lang.SuppressWarnings* @param range an IntRange indicating the indices for the items to retrieve public static java.util.List getAt(float[] array, Range range)
@java.lang.SuppressWarnings* @param range an IntRange indicating the indices for the items to retrieve public static java.util.List getAt(double[] array, Range range)
@java.lang.SuppressWarnings* @param range an IntRange indicating the indices for the items to retrieve public static java.util.List getAt(boolean[] array, Range range)
@java.lang.SuppressWarnings* @param range an IntRange indicating the indices for the items to retrieve public static java.util.List getAt(byte[] array, IntRange range)
@java.lang.SuppressWarnings* @param range an IntRange indicating the indices for the items to retrieve public static java.util.List getAt(char[] array, IntRange range)
@java.lang.SuppressWarnings* @param range an IntRange indicating the indices for the items to retrieve public static java.util.List getAt(short[] array, IntRange range)
@java.lang.SuppressWarnings* @param range an IntRange indicating the indices for the items to retrieve public static java.util.List getAt(int[] array, IntRange range)
@java.lang.SuppressWarnings* @param range an ObjectRange indicating the indices for the items to retrieve public static java.util.List getAt(long[] array, IntRange range)
@java.lang.SuppressWarnings* @param range an ObjectRange indicating the indices for the items to retrieve public static java.util.List getAt(float[] array, IntRange range)
@java.lang.SuppressWarnings* @param range an ObjectRange indicating the indices for the items to retrieve public static java.util.List getAt(double[] array, IntRange range)
@java.lang.SuppressWarnings* @param range an ObjectRange indicating the indices for the items to retrieve public static java.util.List getAt(boolean[] array, IntRange range)
@java.lang.SuppressWarnings* @param range an ObjectRange indicating the indices for the items to retrieve public static java.util.List getAt(byte[] array, ObjectRange range)
@java.lang.SuppressWarnings* @param range an ObjectRange indicating the indices for the items to retrieve public static java.util.List getAt(char[] array, ObjectRange range)
@java.lang.SuppressWarnings* @param range an ObjectRange indicating the indices for the items to retrieve public static java.util.List getAt(short[] array, ObjectRange range)
@java.lang.SuppressWarnings* @param range an ObjectRange indicating the indices for the items to retrieve public static java.util.List getAt(int[] array, ObjectRange range)
@java.lang.SuppressWarnings* @param indices a collection of indices for the items to retrieve public static java.util.List getAt(long[] array, ObjectRange range)
@java.lang.SuppressWarnings* @param indices a collection of indices for the items to retrieve public static java.util.List getAt(float[] array, ObjectRange range)
@java.lang.SuppressWarnings* @param indices a collection of indices for the items to retrieve public static java.util.List getAt(double[] array, ObjectRange range)
@java.lang.SuppressWarnings* @param indices a collection of indices for the items to retrieve public static java.util.List getAt(boolean[] array, ObjectRange range)
@java.lang.SuppressWarnings* @param indices a collection of indices for the items to retrieve public static java.util.List getAt(byte[] array, java.util.Collection indices)
@java.lang.SuppressWarnings* @param indices a collection of indices for the items to retrieve public static java.util.List getAt(char[] array, java.util.Collection indices)
@java.lang.SuppressWarnings* @param indices a collection of indices for the items to retrieve public static java.util.List getAt(short[] array, java.util.Collection indices)
@java.lang.SuppressWarnings* @param indices a collection of indices for the items to retrieve public static java.util.List getAt(int[] array, java.util.Collection indices)
@java.lang.SuppressWarnings* @param index index to retrieve public static java.util.List getAt(long[] array, java.util.Collection indices)
@java.lang.SuppressWarnings* @param range a Range defining the desired subset public static java.util.List getAt(float[] array, java.util.Collection indices)
@java.lang.SuppressWarningsint adjuster = 1; public static java.util.List getAt(double[] array, java.util.Collection indices)
@java.lang.SuppressWarnings} public static java.util.List getAt(boolean[] array, java.util.Collection indices)
public static boolean getAt(java.util.BitSet self, int index)
public static java.util.BitSet getAt(java.util.BitSet self, IntRange range)
@java.lang.Deprecated} public static java.lang.CharSequence getAt(java.lang.CharSequence self, java.util.Collection indices)
@java.lang.Deprecated} public static java.lang.CharSequence getAt(java.lang.CharSequence text, EmptyRange range)
@java.lang.Deprecated} public static java.lang.CharSequence getAt(java.lang.CharSequence text, int index)
@java.lang.Deprecated} public static java.lang.CharSequence getAt(java.lang.CharSequence text, IntRange range)
@java.lang.Deprecated} public static java.lang.CharSequence getAt(java.lang.CharSequence text, Range range)
@java.lang.Deprecated} public static java.util.List getAt(java.util.regex.Matcher self, java.util.Collection indices)
@java.lang.Deprecated} public static java.lang.Object getAt(java.util.regex.Matcher matcher, int idx)
@java.lang.Deprecated} public static java.lang.String getAt(java.lang.String self, java.util.Collection indices)
@java.lang.Deprecated} public static java.lang.String getAt(java.lang.String text, EmptyRange range)
@java.lang.Deprecated} public static java.lang.String getAt(java.lang.String text, int index)
@java.lang.Deprecated} public static java.lang.String getAt(java.lang.String text, IntRange range)
@java.lang.Deprecated} public static java.lang.String getAt(java.lang.String text, Range range)
@java.lang.Deprecated} public static byte[] getBytes(java.io.File file)
@java.lang.DeprecatedResourceGroovyMethods.eachFileMatch(self, nameFilter, closure); public static byte[] getBytes(java.net.URL url)
@java.lang.DeprecatedResourceGroovyMethods.eachDirMatch(self, nameFilter, closure); public static byte[] getBytes(java.io.InputStream is)
@java.lang.Deprecated} public static char[] getChars(java.lang.CharSequence self)
@java.lang.Deprecated} public static char[] getChars(java.lang.String self)
@java.lang.Deprecated} public static int getCount(java.util.regex.Matcher matcher)
public static MetaClass getMetaClass(java.lang.Class c)
public static MetaClass getMetaClass(java.lang.Object obj)
public static MetaClass getMetaClass(GroovyObject obj)
public static java.util.List getMetaPropertyValues(java.lang.Object self)
self
- the receiver object
public static java.util.Map getProperties(java.lang.Object self)
self
- the receiver object
public static java.lang.ClassLoader getRootLoader(java.lang.ClassLoader self)
c
- a class
protected static java.util.List getSubList(java.util.List self, java.util.List splice)
@java.lang.DeprecatedResourceGroovyMethods.eachFile(self, fileType, closure); public static java.lang.String getText(java.io.File file, java.lang.String charset)
@java.lang.DeprecatedResourceGroovyMethods.eachFile(self, closure); public static java.lang.String getText(java.io.File file)
@java.lang.DeprecatedResourceGroovyMethods.eachDir(self, closure); public static java.lang.String getText(java.net.URL url)
@java.lang.Deprecatedthrows FileNotFoundException, IllegalArgumentException { public static java.lang.String getText(java.net.URL url, java.util.Map parameters)
@java.lang.Deprecatedpublic static void traverse(final File self, final Mapoptions, final Closure closure) public static java.lang.String getText(java.net.URL url, java.lang.String charset)
@java.lang.Deprecated public static java.lang.String getText(java.net.URL url, java.util.Map parameters, java.lang.String charset)
@java.lang.Deprecated public static java.lang.String getText(java.io.InputStream is)
@java.lang.Deprecated public static java.lang.String getText(java.io.InputStream is, java.lang.String charset)
@java.lang.Deprecated public static java.lang.String getText(java.io.Reader reader)
@java.lang.Deprecated public static java.lang.String getText(java.io.BufferedReader reader)
public static java.util.Collection grep(java.lang.Object self, java.lang.Object filter)
public static java.util.Collection grep(java.util.Collection self, java.lang.Object filter)
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 ]
self
- a collectionfilter
- the filter to perform on each element of the collection (using the isCase(java.lang.Object, java.lang.Object) method)
public static java.util.Collection grep(java.lang.Object[] self, java.lang.Object filter)
public static java.util.Collection grep(java.lang.Object self)
@java.lang.SuppressWarnings* assert items.grep() == [1, 2, true, 'foo', [4, 5]] public static java.util.Collection grep(java.util.Collection self)
@java.lang.SuppressWarnings* @param self the Iterator from which we count the number of matching occurrences public static java.util.Collection grep(java.lang.Object[] self)
protected static void groupAnswer(java.util.Map answer, java.lang.Object element, java.lang.Object value)
@java.lang.Deprecated* @return a new Map grouped by keys public static java.util.Map groupBy(java.util.Collection self, Closure closure)
public static java.util.Map groupBy(java.lang.Iterable self, Closure closure)
public static java.util.Map groupBy(java.lang.Object[] self, Closure closure)
@java.lang.Deprecated* def data = sql.rows("SELECT * FROM a_table").groupBy({ it.column1 }, { it.column2 }, { it.column3 }) public static java.util.Map groupBy(java.util.Collection self, java.lang.Object... closures)
public static java.util.Map groupBy(java.lang.Iterable self, java.lang.Object... closures)
public static java.util.Map groupBy(java.lang.Object[] self, java.lang.Object... closures)
self
- an array to groupclosures
- an array of closures, each mapping entries on keys
public static java.util.Map groupBy(java.util.Collection self, java.util.List closures)
public static java.util.Map groupBy(java.lang.Iterable self, java.util.List closures)
self
- an array to groupclosures
- a list of closures, each mapping entries on keys
public static java.util.Map groupBy(java.lang.Object[] self, java.util.List closures)
public static java.util.Map groupBy(java.util.Map self, Closure closure)
public static java.util.Map groupBy(java.util.Map self, java.lang.Object... closures)
public static java.util.Map groupBy(java.util.Map self, java.util.List closures)
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.
self
- a map to groupclosures
- a list of closures that map entries on keys
public static java.util.Map groupEntriesBy(java.util.Map self, Closure closure)
@java.lang.Deprecated} public static boolean hasGroup(java.util.regex.Matcher matcher)
public static MetaProperty hasProperty(java.lang.Object self, java.lang.String name)
public static java.lang.Object head(java.util.List self)
def list = [3, 4, 2] assert list.tail() == [4, 2] assert list == [3, 4, 2]
self
- a List
public static java.lang.Object head(java.lang.Object[] self)
public static java.lang.Object identity(java.lang.Object self, Closure closure)
public static java.lang.Boolean implies(java.lang.Boolean left, java.lang.Boolean right)
self
- the iteration object over which to iteratestartIndex
- start matching from this indexclosure
- the filter to perform a match on the collection
public static java.lang.Object inject(java.util.Collection self, Closure closure)
public static java.lang.Object inject(java.util.Collection self, java.lang.Object initialValue, Closure closure)
public static java.lang.Object inject(java.util.Map self, java.lang.Object initialValue, Closure closure)
public static java.lang.Object inject(java.util.Iterator self, java.lang.Object initialValue, Closure closure)
public static java.lang.Object inject(java.lang.Object self, Closure closure)
self
- an ObjectinitialValue
- some initial valueclosure
- a closure
public static java.lang.Object inject(java.lang.Object self, java.lang.Object initialValue, Closure closure)
self
- an Object[]closure
- a closure
public static java.lang.Object inject(java.lang.Object[] self, Closure closure)
public static java.lang.Object inject(java.lang.Object[] self, java.lang.Object initialValue, Closure closure)
public static java.lang.String inspect(java.lang.Object self)
self
- any Object
public static java.lang.Number intdiv(java.lang.Character left, java.lang.Number right)
public static java.lang.Number intdiv(java.lang.Number left, java.lang.Character right)
public static java.lang.Number intdiv(java.lang.Character left, java.lang.Character right)
public static java.lang.Number intdiv(java.lang.Number left, java.lang.Number right)
public static java.util.Collection intersect(java.util.Collection left, java.util.Collection right)
public static java.util.Map intersect(java.util.Map left, java.util.Map right)
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
left
- a Collectionright
- a Collectiontrue
if the intersection of two collections
is empty, false
otherwise.
public static java.lang.Object invokeMethod(java.lang.Object object, java.lang.String method, java.lang.Object arguments)
public static boolean is(java.lang.Object self, java.lang.Object other)
def same = this.is(that)
self
- an objectother
- an object to compare identity with
@java.lang.Deprecated} public static boolean isAllWhitespace(java.lang.CharSequence self)
@java.lang.Deprecated} public static boolean isAllWhitespace(java.lang.String self)
@java.lang.Deprecated} public static boolean isBigDecimal(java.lang.CharSequence self)
@java.lang.Deprecated} public static boolean isBigDecimal(java.lang.String self)
@java.lang.Deprecated} public static boolean isBigInteger(java.lang.CharSequence self)
@java.lang.Deprecated} public static boolean isBigInteger(java.lang.String self)
public static boolean isCase(java.lang.Object caseValue, java.lang.Object switchValue)
public static boolean isCase(java.lang.Class caseValue, java.lang.Object switchValue)
public static boolean isCase(java.util.Collection caseValue, java.lang.Object switchValue)
public static boolean isCase(java.util.Map caseValue, java.lang.Object switchValue)
public static boolean isCase(java.lang.Number caseValue, java.lang.Number switchValue)
@java.lang.Deprecated} public static boolean isCase(java.lang.CharSequence caseValue, java.lang.Object switchValue)
@java.lang.Deprecated} public static boolean isCase(GString caseValue, java.lang.Object switchValue)
@java.lang.Deprecated} public static boolean isCase(java.util.regex.Pattern caseValue, java.lang.Object switchValue)
@java.lang.Deprecated} public static boolean isCase(java.lang.String caseValue, java.lang.Object switchValue)
public static boolean isDigit(java.lang.Character self)
@java.lang.Deprecated} public static boolean isDouble(java.lang.CharSequence self)
@java.lang.Deprecated} public static boolean isDouble(java.lang.String self)
@java.lang.Deprecated} public static boolean isFloat(java.lang.CharSequence self)
@java.lang.Deprecated} public static boolean isFloat(java.lang.String self)
@java.lang.Deprecated} public static boolean isInteger(java.lang.CharSequence self)
@java.lang.Deprecated} public static boolean isInteger(java.lang.String self)
public static boolean isLetter(java.lang.Character self)
self
- a Number
public static boolean isLetterOrDigit(java.lang.Character self)
self
- a Number
@java.lang.Deprecated} public static boolean isLong(java.lang.CharSequence self)
@java.lang.Deprecated} public static boolean isLong(java.lang.String self)
public static boolean isLowerCase(java.lang.Character self)
self
- a Number
@java.lang.Deprecated} public static boolean isNumber(java.lang.CharSequence self)
@java.lang.Deprecated} public static boolean isNumber(java.lang.String self)
public static boolean isUpperCase(java.lang.Character self)
self
- a Number
public static boolean isWhitespace(java.lang.Character self)
public static java.util.Iterator iterator(java.lang.Object[] a)
public static java.util.Iterator iterator(java.lang.Object o)
public static java.util.Iterator iterator(java.util.Enumeration enumeration)
public static java.util.Iterator iterator(java.util.Iterator self)
@java.lang.Deprecated} public static java.util.Iterator iterator(java.util.regex.Matcher matcher)
@java.lang.Deprecatedreturn ResourceGroovyMethods.newPrintWriter(file); public static java.util.Iterator iterator(java.io.Reader self)
@java.lang.Deprecatedreturn ResourceGroovyMethods.newPrintWriter(file, charset); public static java.util.Iterator iterator(java.io.InputStream self)
@java.lang.Deprecatedreturn IOGroovyMethods.newPrintWriter(writer); public static java.util.Iterator iterator(java.io.DataInputStream self)
public static java.lang.String join(java.util.Iterator self, java.lang.String separator)
@java.lang.Deprecated} else { public static java.lang.String join(java.util.Collection self, java.lang.String separator)
public static java.lang.String join(java.lang.Iterable self, java.lang.String separator)
public static java.lang.String join(java.lang.Object[] self, java.lang.String separator)
public static java.lang.Object last(java.util.List self)
public static java.lang.Object last(java.lang.Iterable self)
def array = [3, 4, 2].toArray() assert array.last() == 2
self
- an array
public static java.lang.Object last(java.lang.Object[] self)
public static java.util.Collection leftShift(java.util.Collection self, java.lang.Object value)
self
- a Mapentry
- a Map.Entry to be added to the Map.
public static java.util.concurrent.BlockingQueue leftShift(java.util.concurrent.BlockingQueue self, java.lang.Object value)
public static java.util.Map leftShift(java.util.Map self, java.util.Map$Entry entry)
public static java.util.Map leftShift(java.util.Map self, java.util.Map other)
self
- a Number objectoperand
- the shift distance by which to right shift (unsigned) the number
public static java.lang.Number leftShift(java.lang.Number self, java.lang.Number operand)
array
- a byte arrayrange
- a range indicating the indices for the items to retrieve
@java.lang.Deprecated} public static java.lang.StringBuilder leftShift(java.lang.CharSequence self, java.lang.Object value)
@java.lang.Deprecated} public static java.lang.StringBuffer leftShift(java.lang.String self, java.lang.Object value)
@java.lang.Deprecated} public static java.lang.StringBuffer leftShift(java.lang.StringBuffer self, java.lang.Object value)
@java.lang.Deprecated} public static java.lang.StringBuilder leftShift(java.lang.StringBuilder self, java.lang.Object value)
@java.lang.Deprecatedreturn ResourceGroovyMethods.eachLine(self, firstLine, closure); public static java.io.Writer leftShift(java.net.Socket self, java.lang.Object value)
@java.lang.Deprecatedreturn ResourceGroovyMethods.eachLine(self, charset, firstLine, closure); public static java.io.OutputStream leftShift(java.net.Socket self, byte[] value)
@java.lang.Deprecated} public static java.io.Writer leftShift(java.io.Writer self, java.lang.Object value)
@java.lang.Deprecated} public static java.io.Writer leftShift(java.io.OutputStream self, java.lang.Object value)
@java.lang.Deprecated} public static void leftShift(java.io.ObjectOutputStream self, java.lang.Object value)
@java.lang.Deprecated} public static java.io.OutputStream leftShift(java.io.OutputStream self, java.io.InputStream in)
@java.lang.Deprecated} public static java.io.OutputStream leftShift(java.io.OutputStream self, byte[] value)
@java.lang.Deprecatedreturn ResourceGroovyMethods.asType(f, c); public static java.io.File leftShift(java.io.File file, java.lang.Object text)
@java.lang.Deprecatedreturn ResourceGroovyMethods.asWritable(file, encoding); public static java.io.File leftShift(java.io.File file, byte[] bytes)
@java.lang.Deprecatedreturn ResourceGroovyMethods.newReader(file); public static java.io.File leftShift(java.io.File file, java.io.InputStream data)
@java.lang.Deprecated} public static boolean matches(java.lang.CharSequence self, java.util.regex.Pattern pattern)
@java.lang.Deprecated} public static boolean matches(java.lang.String self, java.util.regex.Pattern pattern)
public static java.util.Map$Entry max(java.util.Map self, Closure closure)
@java.lang.Deprecated* @param self an Iterator public static java.lang.Object max(java.util.Collection self)
public static java.lang.Object max(java.lang.Iterable self)
public static java.lang.Object max(java.util.Iterator self)
public static java.lang.Object max(java.lang.Object[] self)
@java.lang.Deprecated* assert longestName.size() == 8 public static java.lang.Object max(java.util.Collection self, Closure closure)
public static java.lang.Object max(java.lang.Iterable self, Closure closure)
public static java.lang.Object max(java.util.Iterator self, Closure closure)
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.
self
- an Object arrayclosure
- a Closure used to determine the correct ordering
public static java.lang.Object max(java.lang.Object[] self, Closure closure)
@java.lang.Deprecated} public static java.lang.Object max(java.util.Collection self, java.util.Comparator comparator)
public static java.lang.Object max(java.lang.Iterable self, java.util.Comparator comparator)
self
- an Iteratorcomparator
- a Comparator
public static java.lang.Object max(java.util.Iterator self, java.util.Comparator comparator)
size()
method for Iterator
.
The iterator will become exhausted of elements after determining the size value.
self
- an Iterator
public static java.lang.Object max(java.lang.Object[] self, java.util.Comparator comparator)
public static MetaClass metaClass(java.lang.Class self, Closure closure)
enumeration
- an Enumeration object
public static MetaClass metaClass(java.lang.Object self, Closure closure)
self
- an iterator object
public static java.lang.Object min(java.util.Collection self)
assert 2 == [4,2,5].min()
self
- a Collection
public static java.lang.Object min(java.lang.Iterable self)
public static java.lang.Object min(java.util.Iterator self)
public static java.lang.Object min(java.lang.Object[] self)
assert "hi" == ["hello","hi","hey"].min( { a, b -> a.length() <=> b.length() } as Comparator )
self
- an Iterablecomparator
- a Comparator
@java.lang.Deprecated/** public static java.lang.Object min(java.util.Collection self, java.util.Comparator comparator)
public static java.lang.Object min(java.lang.Iterable self, java.util.Comparator comparator)
self
- an Iteratorcomparator
- a Comparator
public static java.lang.Object min(java.util.Iterator self, java.util.Comparator comparator)
public static java.lang.Object min(java.lang.Object[] self, java.util.Comparator comparator)
@java.lang.Deprecated* assert [19, 55, 91].min(lastDigit) == 91 public static java.lang.Object min(java.util.Collection self, Closure closure)
public static java.lang.Object min(java.lang.Iterable self, Closure closure)
public static java.util.Map$Entry min(java.util.Map self, Closure closure)
public static java.lang.Object min(java.util.Iterator self, Closure closure)
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.
self
- an Object arrayclosure
- a Closure used to determine the correct ordering
public static java.lang.Object min(java.lang.Object[] self, Closure closure)
public static java.util.Set minus(java.util.Set self, java.util.Collection removeMe)
self
- a Set objectremoveMe
- the items to remove from the Set
public static java.util.Set minus(java.util.Set self, java.lang.Iterable removeMe)
self
- an object arrayremoveMe
- a Collection of elements to remove
public static java.util.Set minus(java.util.Set self, java.lang.Object removeMe)
@java.lang.SuppressWarnings// element it encounters. public static java.lang.Object[] minus(java.lang.Object[] self, java.lang.Iterable removeMe)
assert [1, "a", true, true, false, 5.3] - [true, 5.3] == [1, "a", false]
self
- a ListremoveMe
- a Collection of elements to remove
@java.lang.SuppressWarningsif (numberComparator.compare(t, (T)t2) == 0) public static java.lang.Object[] minus(java.lang.Object[] self, java.lang.Object[] removeMe)
public static java.util.List minus(java.util.List self, java.util.Collection removeMe)
public static java.util.List minus(java.util.List self, java.lang.Iterable removeMe)
class AbcIterable implements Iterable{ Iterator iterator() { "abc".iterator() } } assert "backtrack".toList() - new AbcIterable() == ["k", "t", "r", "k"]
self
- a ListremoveMe
- an Iterable of elements to remove
public static java.util.List minus(java.util.List self, java.lang.Object removeMe)
@java.lang.SuppressWarnings*assert [1,2,3,4,5] == [1,[2,3],[[4]],[],5].flatten()public static java.lang.Object[] minus(java.lang.Object[] self, java.lang.Object removeMe)
assert [1,2,3,4,5] == [1,[2,3],[[4]],[],5].flatten()
self
- a Collection to flatten
public static java.util.Map minus(java.util.Map self, java.util.Map removeMe)
public static java.lang.Number minus(java.lang.Character left, java.lang.Number right)
public static java.lang.Number minus(java.lang.Number left, java.lang.Character right)
public static java.lang.Number minus(java.lang.Character left, java.lang.Character right)
@java.lang.Deprecated} public static java.lang.CharSequence minus(java.lang.CharSequence self, java.lang.Object target)
@java.lang.Deprecated} public static java.lang.String minus(java.lang.String self, java.lang.Object target)
public static void mixin(MetaClass self, java.util.List categoryClasses)
public static void mixin(java.lang.Class self, java.util.List categoryClasses)
public static void mixin(java.lang.Class self, java.lang.Class categoryClass)
public static void mixin(java.lang.Class self, java.lang.Class[] categoryClass)
public static void mixin(MetaClass self, java.lang.Class categoryClass)
public static void mixin(MetaClass self, java.lang.Class[] categoryClass)
public static java.lang.Number mod(java.lang.Number left, java.lang.Number right)
public static java.util.List multiply(java.util.Collection self, java.lang.Number factor)
public static java.lang.Number multiply(java.lang.Character left, java.lang.Number right)
public static java.lang.Number multiply(java.lang.Number left, java.lang.Character right)
public static java.lang.Number multiply(java.lang.Character left, java.lang.Character right)
public static java.lang.Number multiply(java.math.BigDecimal left, java.lang.Double right)
self
- a Longexponent
- an Integer exponent
public static java.lang.Number multiply(java.math.BigDecimal left, java.math.BigInteger right)
@java.lang.Deprecated} public static java.lang.CharSequence multiply(java.lang.CharSequence self, java.lang.Number factor)
@java.lang.Deprecated} public static java.lang.String multiply(java.lang.String self, java.lang.Number factor)
@java.lang.Deprecated public static java.io.DataInputStream newDataInputStream(java.io.File file)
@java.lang.Deprecated} public static java.io.DataOutputStream newDataOutputStream(java.io.File file)
@java.lang.Deprecated} public static java.io.BufferedInputStream newInputStream(java.io.File file)
@java.lang.Deprecated} public static java.io.BufferedInputStream newInputStream(java.net.URL url)
@java.lang.Deprecated} public static java.io.BufferedInputStream newInputStream(java.net.URL url, java.util.Map parameters)
@java.lang.SuppressWarnings* Sets/updates the metaclass for a given class to a closure. public static java.lang.Object newInstance(java.lang.Class c)
self
- the object whose metaclass we want to setmetaClass
- the new metaclass value
@java.lang.SuppressWarningselse { public static java.lang.Object newInstance(java.lang.Class c, java.lang.Object[] args)
@java.lang.Deprecated} public static java.io.ObjectInputStream newObjectInputStream(java.io.File file)
@java.lang.Deprecated} public static java.io.ObjectInputStream newObjectInputStream(java.io.InputStream inputStream)
@java.lang.Deprecated} public static java.io.ObjectInputStream newObjectInputStream(java.io.InputStream inputStream, java.lang.ClassLoader classLoader)
@java.lang.Deprecated} public static java.io.ObjectInputStream newObjectInputStream(java.io.File file, java.lang.ClassLoader classLoader)
@java.lang.Deprecated} public static java.io.ObjectOutputStream newObjectOutputStream(java.io.File file)
@java.lang.Deprecated} public static java.io.ObjectOutputStream newObjectOutputStream(java.io.OutputStream outputStream)
@java.lang.Deprecated} public static java.io.BufferedOutputStream newOutputStream(java.io.File file)
@java.lang.Deprecated} public static java.io.PrintWriter newPrintWriter(java.io.File file)
@java.lang.Deprecated} public static java.io.PrintWriter newPrintWriter(java.io.File file, java.lang.String charset)
@java.lang.Deprecated} public static java.io.PrintWriter newPrintWriter(java.io.Writer writer)
@java.lang.Deprecatedreturn IOGroovyMethods.withWriter(writer, closure); public static java.io.BufferedReader newReader(java.io.File file)
@java.lang.Deprecatedreturn IOGroovyMethods.withReader(reader, closure); public static java.io.BufferedReader newReader(java.io.File file, java.lang.String charset)
@java.lang.Deprecated} public static java.io.BufferedReader newReader(java.io.InputStream self)
@java.lang.Deprecated} public static java.io.BufferedReader newReader(java.io.InputStream self, java.lang.String charset)
@java.lang.Deprecated} public static java.io.BufferedReader newReader(java.net.URL url)
@java.lang.Deprecated public static java.io.BufferedReader newReader(java.net.URL url, java.util.Map parameters)
@java.lang.Deprecated public static java.io.BufferedReader newReader(java.net.URL url, java.lang.String charset)
@java.lang.Deprecated public static java.io.BufferedReader newReader(java.net.URL url, java.util.Map parameters, java.lang.String charset)
@java.lang.Deprecated} public static java.io.BufferedWriter newWriter(java.io.File file)
@java.lang.Deprecated} public static java.io.BufferedWriter newWriter(java.io.File file, boolean append)
@java.lang.Deprecated} public static java.io.BufferedWriter newWriter(java.io.File file, java.lang.String charset, boolean append)
@java.lang.Deprecated} public static java.io.BufferedWriter newWriter(java.io.File file, java.lang.String charset)
public static java.lang.Character next(java.lang.Character self)
left
- a Numberright
- a Character
public static java.lang.Number next(java.lang.Number self)
left
- a Characterright
- a Character
@java.lang.Deprecated} public static java.lang.CharSequence next(java.lang.CharSequence self)
@java.lang.Deprecated} public static java.lang.String next(java.lang.String self)
@java.lang.Deprecated} public static java.lang.CharSequence normalize(java.lang.CharSequence self)
@java.lang.Deprecated} public static java.lang.String normalize(java.lang.String self)
public static int numberAwareCompareTo(java.lang.Comparable self, java.lang.Comparable other)
self
- a Comparableother
- another Comparable
public static java.lang.Number or(java.lang.Number left, java.lang.Number right)
public static java.util.BitSet or(java.util.BitSet left, java.util.BitSet right)
self
- a Longto
- the end numberclosure
- the code to execute for each number
public static java.lang.Boolean or(java.lang.Boolean left, java.lang.Boolean right)
self
- the iteration object over which to iterateclosure
- the filter to perform a match on the collection
@java.lang.Deprecated} public static java.lang.CharSequence padLeft(java.lang.CharSequence self, java.lang.Number numberOfChars)
@java.lang.Deprecated} public static java.lang.CharSequence padLeft(java.lang.CharSequence self, java.lang.Number numberOfChars, java.lang.CharSequence padding)
@java.lang.Deprecated} public static java.lang.String padLeft(java.lang.String self, java.lang.Number numberOfChars)
@java.lang.Deprecated} public static java.lang.String padLeft(java.lang.String self, java.lang.Number numberOfChars, java.lang.String padding)
@java.lang.Deprecated} public static java.lang.CharSequence padRight(java.lang.CharSequence self, java.lang.Number numberOfChars)
@java.lang.Deprecated} public static java.lang.CharSequence padRight(java.lang.CharSequence self, java.lang.Number numberOfChars, java.lang.CharSequence padding)
@java.lang.Deprecated} public static java.lang.String padRight(java.lang.String self, java.lang.Number numberOfChars)
@java.lang.Deprecated} public static java.lang.String padRight(java.lang.String self, java.lang.Number numberOfChars, java.lang.String padding)
public static java.util.Set permutations(java.util.List self)
public static java.util.List permutations(java.util.List self, Closure function)
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]]
self
- the Collection of itemsclosure
- the closure to call for each permutation
public static java.util.Map plus(java.util.Map left, java.util.Map right)
assert [String, Long, Integer] == ["a",5L,2]["class"]
coll
- a Collectionproperty
- a String
public static java.util.Map plus(java.util.Map self, java.util.Collection entries)
@java.lang.SuppressWarnings*/ public static java.lang.Object[] plus(java.lang.Object[] left, java.lang.Object[] right)
@java.lang.SuppressWarnings* @param left the array public static java.lang.Object[] plus(java.lang.Object[] left, java.lang.Object right)
@java.lang.SuppressWarnings* @param right the right Collection public static java.lang.Object[] plus(java.lang.Object[] left, java.util.Collection right)
@java.lang.SuppressWarningspublic staticCollection plus(Collection left, Iterable right) { public static java.lang.Object[] plus(java.lang.Object[] left, java.lang.Iterable right)
left
- the left Collectionright
- the right Iterable
public static java.util.Collection plus(java.util.Collection left, java.util.Collection right)
public static java.util.Collection plus(java.util.Collection left, java.lang.Iterable right)
public static java.util.List plus(java.util.List self, int index, java.lang.Object[] items)
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.
self
- an original Listadditions
- a List containing elements to be merged with elements from the original Listindex
- index at which to insert the first element from the given additions List
public static java.util.List plus(java.util.List self, int index, java.util.List additions)
self
- an original listadditions
- an Iterable containing elements to be merged with the elements from the original Listindex
- index at which to insert the first element from the given additions Iterable
public static java.util.List plus(java.util.List self, int index, java.lang.Iterable additions)
assert [1,2,3,1,2,3] == [1,2,3] * 2
self
- a Collectionfactor
- the number of times to append
public static java.util.Collection plus(java.util.Collection left, java.lang.Object right)
public static java.lang.Number plus(java.lang.Character left, java.lang.Number right)
public static java.lang.Number plus(java.lang.Number left, java.lang.Character right)
public static java.lang.Number plus(java.lang.Character left, java.lang.Character right)
left
- a Characterright
- a Number
@java.lang.Deprecated} public static java.lang.CharSequence plus(java.lang.CharSequence left, java.lang.Object value)
@java.lang.Deprecated} public static java.lang.String plus(java.lang.Number value, java.lang.String right)
@java.lang.Deprecated} public static java.lang.String plus(java.lang.String left, java.lang.Object value)
@java.lang.Deprecated} public static java.lang.String plus(java.lang.StringBuffer left, java.lang.String value)
public static java.lang.Object pop(java.util.List self)
public static java.lang.Number power(java.lang.Number self, java.lang.Number exponent)
public static java.lang.Number power(java.math.BigDecimal self, java.lang.Integer exponent)
left
- a Characterright
- another Character
public static java.lang.Number power(java.math.BigInteger self, java.lang.Integer exponent)
left
- a Characterright
- a Number
public static java.lang.Number power(java.lang.Integer self, java.lang.Integer exponent)
public static java.lang.Number power(java.lang.Long self, java.lang.Integer exponent)
left
- a Numberright
- another Number
public static java.lang.Character previous(java.lang.Character self)
public static java.lang.Number previous(java.lang.Number self)
@java.lang.Deprecated} public static java.lang.CharSequence previous(java.lang.CharSequence self)
@java.lang.Deprecated} public static java.lang.String previous(java.lang.String self)
protected static java.lang.Object primitiveArrayGet(java.lang.Object self, int idx)
self
- the array we are searchingvalue
- the value being searched for
protected static java.util.List primitiveArrayGet(java.lang.Object self, Range range)
protected static java.util.List primitiveArrayGet(java.lang.Object self, java.util.Collection indices)
self
- the array within which we count the number of occurrencesvalue
- the value being searched for
protected static java.lang.Object primitiveArrayPut(java.lang.Object self, int idx, java.lang.Object newValue)
self
- the array we are searchingvalue
- the value being searched for
public static void print(java.lang.Object self, java.lang.Object value)
self
- any Objectvalue
- the value to print
public static void print(java.io.PrintWriter self, java.lang.Object value)
self
- a PrintWritervalue
- the value to print
public static void print(java.io.PrintStream self, java.lang.Object value)
public static void print(Closure self, java.lang.Object value)
public static void print(java.lang.Object self, java.io.PrintWriter out)
public static void printf(java.lang.Object self, java.lang.String format, java.lang.Object[] values)
public static void printf(java.lang.Object self, java.lang.String format, java.lang.Object arg)
public static void println(java.lang.Object self)
public static void println(Closure self)
self
- a closure
public static void println(java.lang.Object self, java.lang.Object value)
self
- any Objectvalue
- the value to print
public static void println(java.io.PrintWriter self, java.lang.Object value)
self
- a PrintWritervalue
- the value to print
public static void println(java.io.PrintStream self, java.lang.Object value)
public static void println(Closure self, java.lang.Object value)
public static void println(java.lang.Object self, java.io.PrintWriter out)
public static boolean push(java.util.List self, java.lang.Object value)
public static java.util.Map putAll(java.util.Map self, java.util.Collection entries)
public static void putAt(java.lang.Object self, java.lang.String property, java.lang.Object newValue)
public static void putAt(java.util.List self, int idx, java.lang.Object value)
public static void putAt(java.util.List self, EmptyRange range, java.lang.Object value)
def list = ["a", true] list[1..<1] = [4, 3, 2] assert list == ["a", 4, 3, 2, true]
self
- a Listrange
- the (in this case empty) subset of the list to setvalue
- the Collection of values
public static void putAt(java.util.List self, EmptyRange range, java.util.Collection value)
public static void putAt(java.util.List self, IntRange range, java.util.Collection col)
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.
self
- a Listrange
- the subset of the list to setvalue
- the value to put at the given sublist
public static void putAt(java.util.List self, IntRange range, java.lang.Object value)
public static void putAt(java.util.List self, java.util.List splice, java.util.List values)
def list = ["a", true, 42, 9.4] list[1, 3] = 5 assert list == ["a", 5, 42, 5]
self
- a Listsplice
- the subset of the list to setvalue
- the value to put at the given sublist
public static void putAt(java.util.List self, java.util.List splice, java.lang.Object value)
public static java.lang.Object putAt(java.util.Map self, java.lang.Object key, java.lang.Object value)
public static void putAt(java.util.BitSet self, IntRange range, boolean value)
self
- a BitSetrange
- the range of values to setvalue
- value
public static void putAt(java.util.BitSet self, int index, boolean value)
array
- a byte array
@java.lang.Deprecated} public static void putAt(java.lang.StringBuffer self, EmptyRange range, java.lang.Object value)
@java.lang.Deprecated} public static void putAt(java.lang.StringBuffer self, IntRange range, java.lang.Object value)
@java.lang.Deprecated public static byte[] readBytes(java.io.File file)
@java.lang.Deprecated} public static java.lang.String readLine(java.io.Reader self)
@java.lang.Deprecated} public static java.util.List readLines(java.lang.CharSequence self)
@java.lang.Deprecated} public static java.util.List readLines(java.lang.String self)
@java.lang.Deprecated} public static java.util.List readLines(java.io.File file)
@java.lang.Deprecated} public static java.util.List readLines(java.io.File file, java.lang.String charset)
@java.lang.Deprecated} public static java.util.List readLines(java.io.InputStream stream)
@java.lang.Deprecated} public static java.util.List readLines(java.io.InputStream stream, java.lang.String charset)
@java.lang.Deprecated} public static java.util.List readLines(java.net.URL self)
@java.lang.Deprecated} public static java.util.List readLines(java.net.URL self, java.lang.String charset)
@java.lang.Deprecated} public static java.util.List readLines(java.io.Reader reader)
public static boolean removeAll(java.util.Collection self, java.lang.Object[] items)
public static boolean removeAll(java.util.Collection self, Closure condition)
@java.lang.Deprecatedreturn ResourceGroovyMethods.withWriterAppend(file, closure); public static boolean renameTo(java.io.File self, java.lang.String newPathName)
@java.lang.Deprecated} public static java.lang.CharSequence replaceAll(java.lang.CharSequence self, java.lang.CharSequence regex, java.lang.CharSequence replacement)
@java.lang.Deprecated} public static java.lang.CharSequence replaceAll(java.lang.CharSequence self, java.lang.CharSequence regex, Closure closure)
@java.lang.Deprecated} public static java.lang.CharSequence replaceAll(java.lang.CharSequence self, java.util.regex.Pattern pattern, java.lang.CharSequence replacement)
@java.lang.Deprecated} public static java.lang.String replaceAll(java.lang.CharSequence self, java.util.regex.Pattern pattern, Closure closure)
@java.lang.Deprecated} public static java.lang.String replaceAll(java.lang.String self, java.util.regex.Pattern pattern, Closure closure)
@java.lang.Deprecated} public static java.lang.String replaceAll(java.lang.String self, java.util.regex.Pattern pattern, java.lang.String replacement)
@java.lang.Deprecated} public static java.lang.String replaceAll(java.lang.String self, java.lang.String regex, Closure closure)
@java.lang.Deprecated} public static java.lang.String replaceFirst(java.lang.CharSequence self, java.lang.CharSequence regex, java.lang.CharSequence replacement)
@java.lang.Deprecated} public static java.lang.String replaceFirst(java.lang.CharSequence self, java.lang.CharSequence regex, Closure closure)
@java.lang.Deprecated} public static java.lang.CharSequence replaceFirst(java.lang.CharSequence self, java.util.regex.Pattern pattern, java.lang.CharSequence replacement)
@java.lang.Deprecated} public static java.lang.String replaceFirst(java.lang.CharSequence self, java.util.regex.Pattern pattern, Closure closure)
@java.lang.Deprecated} public static java.lang.String replaceFirst(java.lang.String self, java.util.regex.Pattern pattern, Closure closure)
@java.lang.Deprecated} public static java.lang.String replaceFirst(java.lang.String self, java.util.regex.Pattern pattern, java.lang.String replacement)
@java.lang.Deprecated} public static java.lang.String replaceFirst(java.lang.String self, java.lang.String regex, Closure closure)
public static java.util.List respondsTo(java.lang.Object self, java.lang.String name, java.lang.Object[] argTypes)
public static java.util.List respondsTo(java.lang.Object self, java.lang.String name)
public static boolean retainAll(java.util.Collection self, java.lang.Object[] items)
public static boolean retainAll(java.util.Collection self, Closure condition)
public static java.util.List reverse(java.util.List self)
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"]
self
- a Listmutate
- true if the list itself should be reversed in place and returned, false if a new list should be created
public static java.util.List reverse(java.util.List self, boolean mutate)
@java.lang.SuppressWarningsreturn new ReverseListIterator(toList(self)); public static java.lang.Object[] reverse(java.lang.Object[] self)
self
- an Iterator
@java.lang.SuppressWarnings* @since 1.8.7 public static java.lang.Object[] reverse(java.lang.Object[] self, boolean mutate)
public static java.util.Iterator reverse(java.util.Iterator self)
Integer[] a = [1, 2, 3] Integer[] result = a + 4 assert result == [1, 2, 3, 4] as Integer[]
left
- the arrayright
- the value to append
@java.lang.Deprecated} public static java.lang.CharSequence reverse(java.lang.CharSequence self)
@java.lang.Deprecated} public static java.lang.String reverse(java.lang.String self)
public static java.util.Map reverseEach(java.util.Map self, Closure closure)
public static java.util.List reverseEach(java.util.List self, Closure closure)
public static java.lang.Object[] reverseEach(java.lang.Object[] self, Closure closure)
public static java.lang.Number rightShift(java.lang.Number self, java.lang.Number operand)
array
- a char arrayrange
- a range indicating the indices for the items to retrieve
public static java.lang.Number rightShiftUnsigned(java.lang.Number self, java.lang.Number operand)
array
- a short arrayrange
- a range indicating the indices for the items to retrieve
public static int round(java.lang.Float number)
public static float round(java.lang.Float number, int precision)
public static long round(java.lang.Double number)
public static double round(java.lang.Double number, int precision)
public static java.util.TimerTask runAfter(java.util.Timer timer, int delay, Closure closure)
self
- the iteration object over which to iterateclosure
- the filter to perform a match on the collection
@java.lang.Deprecatedreturn ResourceGroovyMethods.deleteDir(self); public static void setBytes(java.io.File file, byte[] bytes)
@java.lang.Deprecatedreturn ResourceGroovyMethods.renameTo(self, newPathName); public static void setBytes(java.io.OutputStream os, byte[] bytes)
@java.lang.Deprecated} public static void setIndex(java.util.regex.Matcher matcher, int idx)
public static void setMetaClass(java.lang.Class self, MetaClass metaClass)
public static void setMetaClass(java.lang.Object self, MetaClass metaClass)
public static void setMetaClass(GroovyObject self, MetaClass metaClass)
a
- an array
@java.lang.Deprecatedreturn IOGroovyMethods.iterator(self); public static void setText(java.io.File file, java.lang.String text)
@java.lang.Deprecatedreturn ResourceGroovyMethods.asWritable(file); public static void setText(java.io.File file, java.lang.String text, java.lang.String charset)
public static int size(java.util.Iterator self)
public static int size(java.lang.Object[] self)
public static int size(boolean[] array)
public static int size(byte[] array)
public static int size(char[] array)
public static int size(short[] array)
array
- an int array
public static int size(int[] array)
array
- a long array
public static int size(long[] array)
public static int size(float[] array)
public static int size(double[] array)
@java.lang.Deprecated} public static int size(java.lang.CharSequence text)
@java.lang.Deprecated} public static long size(java.util.regex.Matcher self)
@java.lang.Deprecated} public static int size(java.lang.String text)
@java.lang.Deprecated} public static int size(java.lang.StringBuffer buffer)
@java.lang.Deprecated} public static long size(java.io.File self)
@java.lang.Deprecated/** public static java.util.List sort(java.util.Collection self)
public static java.util.List sort(java.lang.Iterable self)
@java.lang.Deprecated* the closure as a comparator to determine the ordering. public static java.util.List sort(java.util.Collection self, boolean mutate)
public static java.util.List sort(java.lang.Iterable self, boolean mutate)
public static java.util.Map sort(java.util.Map self, Closure closure)
public static java.util.Map sort(java.util.Map self, java.util.Comparator comparator)
self
- the array to be sorted
public static java.util.Map sort(java.util.Map self)
public static java.lang.Object[] sort(java.lang.Object[] self)
public static java.lang.Object[] sort(java.lang.Object[] self, boolean mutate)
self
- the Iterator to be sortedcomparator
- a Comparator used for comparing items
public static java.util.Iterator sort(java.util.Iterator self)
public static java.util.Iterator sort(java.util.Iterator self, java.util.Comparator comparator)
@java.lang.Deprecatedpublic staticList sort(Collection self, boolean mutate, Comparator comparator) { public static java.util.List sort(java.util.Collection self, java.util.Comparator comparator)
public static java.util.List sort(java.lang.Iterable self, java.util.Comparator comparator)
@java.lang.Deprecated* Sorts the given array into sorted order using the given comparator. public static java.util.List sort(java.util.Collection self, boolean mutate, java.util.Comparator comparator)
public static java.util.List sort(java.lang.Iterable self, boolean mutate, java.util.Comparator comparator)
public static java.lang.Object[] sort(java.lang.Object[] self, java.util.Comparator comparator)
public static java.lang.Object[] sort(java.lang.Object[] self, boolean mutate, java.util.Comparator comparator)
public static java.util.Iterator sort(java.util.Iterator self, Closure closure)
@java.lang.SuppressWarningsT[] answer = (T[]) sort(toList(self), closure).toArray(); public static java.lang.Object[] sort(java.lang.Object[] self, Closure closure)
@java.lang.SuppressWarningsreturn sort((Iterable)self, closure); public static java.lang.Object[] sort(java.lang.Object[] self, boolean mutate, Closure closure)
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() }
self
- a Collection to be sortedclosure
- a 1 or 2 arg Closure used to determine the correct ordering
public static java.util.List sort(java.util.Collection self, Closure closure)
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() }
self
- the Iterable to be sortedclosure
- a 1 or 2 arg Closure used to determine the correct ordering
public static java.util.List sort(java.lang.Iterable self, Closure closure)
@java.lang.Deprecated*/ public static java.util.List sort(java.util.Collection self, boolean mutate, Closure closure)
public static java.util.List sort(java.lang.Iterable self, boolean mutate, Closure closure)
self
- an already sorted set
public static java.util.SortedSet sort(java.util.SortedSet self)
def list = ["a", false, 2] assert list.pop() == 2 assert list == ["a", false]
self
- a List
public static java.util.SortedMap sort(java.util.SortedMap self)
self
- a Mapentries
- a Collection of Map.Entry items to be added to the Map.
public static java.util.Collection split(java.lang.Object self, Closure closure)
public static java.util.Collection split(java.util.Collection self, Closure closure)
@java.lang.Deprecated} public static java.lang.CharSequence[] split(java.lang.CharSequence self)
@java.lang.Deprecated} public static java.lang.String[] split(GString self)
@java.lang.Deprecated} public static java.lang.String[] split(java.lang.String self)
@java.lang.Deprecated} public static java.lang.Object splitEachLine(java.lang.CharSequence self, java.lang.CharSequence regex, Closure closure)
@java.lang.Deprecated} public static java.lang.Object splitEachLine(java.lang.CharSequence self, java.util.regex.Pattern pattern, Closure closure)
@java.lang.Deprecatedreturn StringGroovyMethods.tokenize(self); public static java.lang.Object splitEachLine(java.lang.String self, java.util.regex.Pattern pattern, Closure closure)
@java.lang.Deprecatedreturn StringGroovyMethods.tokenize(self, token); public static java.lang.Object splitEachLine(java.lang.String self, java.lang.String regex, Closure closure)
@java.lang.Deprecated} public static java.lang.Object splitEachLine(java.io.File self, java.lang.String regex, Closure closure)
@java.lang.Deprecated} public static java.lang.Object splitEachLine(java.io.File self, java.util.regex.Pattern pattern, Closure closure)
@java.lang.Deprecated} public static java.lang.Object splitEachLine(java.io.File self, java.lang.String regex, java.lang.String charset, Closure closure)
@java.lang.Deprecated} public static java.lang.Object splitEachLine(java.io.File self, java.util.regex.Pattern pattern, java.lang.String charset, Closure closure)
@java.lang.Deprecated} public static java.lang.Object splitEachLine(java.net.URL self, java.lang.String regex, Closure closure)
@java.lang.Deprecated} public static java.lang.Object splitEachLine(java.net.URL self, java.util.regex.Pattern pattern, Closure closure)
@java.lang.Deprecated} public static java.lang.Object splitEachLine(java.net.URL self, java.lang.String regex, java.lang.String charset, Closure closure)
@java.lang.Deprecated} public static java.lang.Object splitEachLine(java.net.URL self, java.util.regex.Pattern pattern, java.lang.String charset, Closure closure)
@java.lang.Deprecated} public static java.lang.Object splitEachLine(java.io.Reader self, java.lang.String regex, Closure closure)
@java.lang.Deprecated} public static java.lang.Object splitEachLine(java.io.Reader self, java.util.regex.Pattern pattern, Closure closure)
@java.lang.Deprecated} public static java.lang.Object splitEachLine(java.io.InputStream stream, java.lang.String regex, java.lang.String charset, Closure closure)
@java.lang.Deprecated} public static java.lang.Object splitEachLine(java.io.InputStream stream, java.util.regex.Pattern pattern, java.lang.String charset, Closure closure)
@java.lang.Deprecated} public static java.lang.Object splitEachLine(java.io.InputStream stream, java.lang.String regex, Closure closure)
@java.lang.Deprecated} public static java.lang.Object splitEachLine(java.io.InputStream stream, java.util.regex.Pattern pattern, Closure closure)
public static SpreadMap spread(java.util.Map self)
public static java.lang.String sprintf(java.lang.Object self, java.lang.String format, java.lang.Object[] values)
public static java.lang.String sprintf(java.lang.Object self, java.lang.String format, java.lang.Object arg)
public static void step(java.lang.Number self, java.lang.Number to, java.lang.Number stepNumber, Closure closure)
number
- a Float
@java.lang.Deprecatedpublic static Listtokenize(String self, String token) { public static java.lang.CharSequence stripIndent(java.lang.CharSequence self)
@java.lang.Deprecatedpublic static ListtoList(CharSequence self) { public static java.lang.CharSequence stripIndent(java.lang.CharSequence self, int numChars)
@java.lang.Deprecatedpublic static ListtoList(String self) { public static java.lang.String stripIndent(java.lang.String self)
@java.lang.Deprecatedpublic static Long toLong(CharSequence self) { public static java.lang.String stripIndent(java.lang.String self, int numChars)
@java.lang.Deprecatedpublic static Long toLong(String self) { public static java.lang.CharSequence stripMargin(java.lang.CharSequence self)
@java.lang.Deprecatedpublic static SettoSet(CharSequence self) { public static java.lang.CharSequence stripMargin(java.lang.CharSequence self, char marginChar)
@java.lang.Deprecatedpublic static SettoSet(String self) { public static java.lang.String stripMargin(java.lang.CharSequence self, java.lang.CharSequence marginChar)
@java.lang.Deprecatedpublic static Short toShort(CharSequence self) { public static java.lang.String stripMargin(java.lang.String self)
@java.lang.Deprecatedpublic static Short toShort(String self) { public static java.lang.String stripMargin(java.lang.String self, char marginChar)
@java.lang.Deprecatedpublic static URI toURI(CharSequence self) throws URISyntaxException { public static java.lang.String stripMargin(java.lang.String self, java.lang.String marginChar)
public static java.util.Map subMap(java.util.Map map, java.util.Collection keys)
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
map
- a Mapkeys
- an array of keys
public static java.util.Map subMap(java.util.Map map, java.lang.Object[] keys)
def map=[:] map.get("a", []) << 5 assert map == [a:[5]]
map
- a Mapkey
- the key to lookup the value ofdefaultValue
- the value to return and add to the map for this key if
there is no entry for the given key
public static java.util.Set subsequences(java.util.List self)
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
self
- the Collection of items
@java.lang.Deprecated* @see #sum(java.util.Collection) public static java.lang.Object sum(java.util.Collection self)
public static java.lang.Object sum(java.lang.Iterable self)
public static java.lang.Object sum(java.lang.Object[] self)
public static java.lang.Object sum(java.util.Iterator self)
@java.lang.Deprecated* @param initialValue the items in the array will be summed to this initial value public static java.lang.Object sum(java.util.Collection self, java.lang.Object initialValue)
public static java.lang.Object sum(java.lang.Iterable self, java.lang.Object initialValue)
public static java.lang.Object sum(java.lang.Object[] self, java.lang.Object initialValue)
public static java.lang.Object sum(java.util.Iterator self, java.lang.Object initialValue)
@java.lang.Deprecated* array.collect(closure).sum()
.
public static java.lang.Object sum(java.util.Collection self, Closure closure)
coll.sum(closure)
is equivalent to:
coll.collect(closure).sum()
.
assert 4+6+10+12 == [2,3,5,6].sum() { it * 2 }
self
- an Iterableclosure
- a single parameter closure that returns a numeric value.
public static java.lang.Object sum(java.lang.Iterable self, Closure closure)
public static java.lang.Object sum(java.lang.Object[] self, Closure closure)
public static java.lang.Object sum(java.util.Iterator self, Closure closure)
@java.lang.Deprecated* array.sum(initVal, closure)
is equivalent to:
public static java.lang.Object sum(java.util.Collection self, java.lang.Object initialValue, Closure closure)
public static java.lang.Object sum(java.lang.Iterable self, java.lang.Object initialValue, Closure closure)
public static java.lang.Object sum(java.lang.Object[] self, java.lang.Object initialValue, Closure closure)
public static java.lang.Object sum(java.util.Iterator self, java.lang.Object initialValue, Closure closure)
public static java.util.List tail(java.util.List self)
public static java.lang.Object[] tail(java.lang.Object[] self)
public static java.util.List take(java.util.List self, int num)
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[]
self
- the original arraynum
- the number of elements to take from this arraynum
elements of this array,
or else the whole array if it has less then num
elements.
public static java.lang.Object[] take(java.lang.Object[] self, int num)
public static java.util.List take(java.lang.Iterable self, int num)
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 ]
self
- the original mapnum
- the number of elements to take from this mapnum
elements of this map,
or else the whole map if it has less then num
elements.
public static java.util.Map take(java.util.Map self, int num)
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 ] )
self
- the Iteratornum
- the number of elements to take from this iteratornum
elements of this iterator.
@java.lang.SuppressWarnings public static java.util.Iterator take(java.util.Iterator self, int num)
@java.lang.DeprecatedListret = createSimilarList(self, self.size() - num); public static java.lang.CharSequence take(java.lang.CharSequence self, int num)
public static java.util.List takeWhile(java.util.List self, Closure condition)
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']
self
- an Iterablecondition
- the closure that must evaluate to true to
continue taking elements
public static java.util.List takeWhile(java.lang.Iterable self, Closure condition)
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.
self
- a Mapcondition
- a 1 (or 2) arg Closure that must evaluate to true for the
entry (or key and value) to continue taking elements
public static java.util.Map takeWhile(java.util.Map self, Closure condition)
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[]
self
- the original arraycondition
- the closure that must evaluate to true to
continue taking elements
public static java.lang.Object[] takeWhile(java.lang.Object[] self, Closure condition)
public static java.util.Iterator takeWhile(java.util.Iterator self, Closure condition)
public static void times(java.lang.Number self, Closure closure)
public static java.lang.String toArrayString(java.lang.Object[] self)
public static java.math.BigDecimal toBigDecimal(java.lang.Number self)
left
- left operatorright
- right operator
@java.lang.Deprecatedpublic static URI toURI(String self) throws URISyntaxException { public static java.math.BigDecimal toBigDecimal(java.lang.CharSequence self)
@java.lang.Deprecatedpublic static URL toURL(CharSequence self) throws MalformedURLException { public static java.math.BigDecimal toBigDecimal(java.lang.String self)
public static java.math.BigInteger toBigInteger(java.lang.Number self)
self
- the iteration object over which to iterateclosure
- the filter to perform a match on the collection
@java.lang.Deprecatedpublic static URL toURL(String self) throws MalformedURLException { public static java.math.BigInteger toBigInteger(java.lang.CharSequence self)
@java.lang.Deprecatedpublic static CharSequence tr(final CharSequence self, CharSequence sourceSet, CharSequence replacementSet) throws ClassNotFoundException { public static java.math.BigInteger toBigInteger(java.lang.String self)
public static java.lang.Boolean toBoolean(java.lang.Boolean self)
@java.lang.Deprecatedpublic static String tr(final String self, String sourceSet, String replacementSet) throws ClassNotFoundException { public static java.lang.Boolean toBoolean(java.lang.String self)
@java.lang.Deprecatedpublic static CharSequence unexpand(CharSequence self) { public static java.lang.Character toCharacter(java.lang.String self)
public static java.lang.Double toDouble(java.lang.Number self)
@java.lang.Deprecatedpublic static CharSequence unexpand(CharSequence self, int tabStop) { public static java.lang.Double toDouble(java.lang.CharSequence self)
@java.lang.Deprecatedpublic static String unexpand(String self) { public static java.lang.Double toDouble(java.lang.String self)
public static java.lang.Float toFloat(java.lang.Number self)
@java.lang.Deprecatedpublic static String unexpand(String self, int tabStop) { public static java.lang.Float toFloat(java.lang.CharSequence self)
@java.lang.Deprecatedpublic static CharSequence unexpandLine(CharSequence self, int tabStop) { public static java.lang.Float toFloat(java.lang.String self)
public static java.lang.Integer toInteger(java.lang.Number self)
@java.lang.Deprecatedpublic static String unexpandLine(String self, int tabStop) { public static java.lang.Integer toInteger(java.lang.CharSequence self)
@java.lang.Deprecatedpublic static Process execute(final String self) throws IOException { public static java.lang.Integer toInteger(java.lang.String self)
public static java.util.List toList(java.util.Collection self)
self
- an iterator
public static java.util.List toList(java.util.Iterator self)
public static java.util.List toList(java.lang.Iterable self)
self
- an enumeration
public static java.util.List toList(java.util.Enumeration self)
public static java.util.List toList(java.lang.Object[] array)
@java.lang.SuppressWarnings* added to the set. public static java.util.List toList(byte[] array)
@java.lang.SuppressWarnings* added to the set. public static java.util.List toList(boolean[] array)
@java.lang.SuppressWarnings* added to the set. public static java.util.List toList(char[] array)
@java.lang.SuppressWarnings* added to the set. public static java.util.List toList(short[] array)
@java.lang.SuppressWarnings* added to the set. public static java.util.List toList(int[] array)
@java.lang.SuppressWarnings* added to the set. public static java.util.List toList(long[] array)
@java.lang.SuppressWarnings* added to the set. public static java.util.List toList(float[] array)
@java.lang.SuppressWarnings* even if the Collection is already a Set. public static java.util.List toList(double[] array)
@java.lang.Deprecated} public static java.util.List toList(java.lang.CharSequence self)
@java.lang.Deprecated} public static java.util.List toList(java.lang.String self)
public static java.lang.String toListString(java.util.Collection self)
public static java.lang.String toListString(java.util.Collection self, int maxSize)
public static java.lang.Long toLong(java.lang.Number self)
@java.lang.Deprecated} public static java.lang.Long toLong(java.lang.CharSequence self)
@java.lang.Deprecated} public static java.lang.Long toLong(java.lang.String self)
public static char toLowerCase(java.lang.Character self)
public static java.lang.String toMapString(java.util.Map self)
public static java.lang.String toMapString(java.util.Map self, int maxSize)
@java.lang.SuppressWarningspublic staticSet toSet(Collection self) { public static java.util.Set toSet(byte[] array)
@java.lang.SuppressWarnings*/ public static java.util.Set toSet(boolean[] array)
@java.lang.SuppressWarnings* @return a Set public static java.util.Set toSet(char[] array)
@java.lang.SuppressWarnings* public static java.util.Set toSet(short[] array)
@java.lang.SuppressWarnings* @param self an array object public static java.util.Set toSet(int[] array)
@java.lang.SuppressWarnings public static java.util.Set toSet(long[] array)
@java.lang.SuppressWarningsfor (Object value : indices) { public static java.util.Set toSet(float[] array)
self
- an array objectindices
- the indices of interest
@java.lang.SuppressWarnings/** public static java.util.Set toSet(double[] array)
public static java.util.Set toSet(java.util.Collection self)
self
- an objectidx
- the index of interestnewValue
- the new value to be put into the index of interest
public static java.util.Set toSet(java.util.Iterator self)
self
- the array we are searchingvalue
- the value being searched for
public static java.util.Set toSet(java.util.Enumeration self)
self
- the array we are searchingvalue
- the value being searched for
@java.lang.Deprecated} public static java.util.Set toSet(java.lang.CharSequence self)
@java.lang.Deprecated} public static java.util.Set toSet(java.lang.String self)
@java.lang.Deprecated} public static java.lang.Short toShort(java.lang.CharSequence self)
@java.lang.Deprecatedreturn SocketGroovyMethods.accept(serverSocket, runInANewThread, closure); public static java.lang.Short toShort(java.lang.String self)
public static SpreadMap toSpreadMap(java.util.Map self)
self
- an object array
public static SpreadMap toSpreadMap(java.lang.Object[] self)
public static SpreadMap toSpreadMap(java.util.List self)
public static java.lang.String toString(boolean[] self)
public static java.lang.String toString(byte[] self)
public static java.lang.String toString(char[] self)
public static java.lang.String toString(short[] self)
public static java.lang.String toString(int[] self)
[1, 2, a]
.
self
- a CollectionmaxSize
- stop after approximately this many characters and append '...'
public static java.lang.String toString(long[] self)
public static java.lang.String toString(float[] self)
public static java.lang.String toString(double[] self)
public static java.lang.String toString(java.util.AbstractMap self)
public static java.lang.String toString(java.util.AbstractCollection self)
self
- a Number
public static java.lang.String toString(java.lang.Object[] self)
public static java.lang.String toString(java.lang.Object value)
@java.lang.Deprecatedreturn ResourceGroovyMethods.size(self); public static java.net.URI toURI(java.lang.CharSequence self)
@java.lang.Deprecatedreturn IOGroovyMethods.leftShift(self, value); public static java.net.URI toURI(java.lang.String self)
@java.lang.DeprecatedIOGroovyMethods.write(self, writable); public static java.net.URL toURL(java.lang.CharSequence self)
@java.lang.Deprecatedreturn IOGroovyMethods.leftShift(self, value); public static java.net.URL toURL(java.lang.String self)
public static char toUpperCase(java.lang.Character self)
@java.lang.Deprecatedpublic static Process execute(final String self, final String[] envp, final File dir) throws IOException { public static java.util.List tokenize(java.lang.CharSequence self)
@java.lang.Deprecatedpublic static Process execute(final String self, final List envp, final File dir) throws IOException { public static java.util.List tokenize(java.lang.CharSequence self, java.lang.Character token)
@java.lang.Deprecatedpublic static Process execute(final String[] commandArray) throws IOException { public static java.util.List tokenize(java.lang.CharSequence self, java.lang.CharSequence token)
@java.lang.Deprecatedpublic static Process execute(final String[] commandArray, final String[] envp, final File dir) throws IOException { @java.lang.SuppressWarningsreturn ProcessGroovyMethods.execute(commandArray, envp, dir); public static java.util.List tokenize(java.lang.String self)
@java.lang.Deprecatedreturn ProcessGroovyMethods.execute(commandArray, envp, dir); public static java.util.List tokenize(java.lang.String self, java.lang.Character token)
@java.lang.Deprecatedreturn ProcessGroovyMethods.execute(commands); @java.lang.SuppressWarnings} public static java.util.List tokenize(java.lang.String self, java.lang.String token)
@java.lang.DeprecatedIOGroovyMethods.leftShift(self, value); public static java.lang.CharSequence tr(java.lang.CharSequence self, java.lang.CharSequence sourceSet, java.lang.CharSequence replacementSet)
@java.lang.Deprecatedreturn IOGroovyMethods.leftShift(self, in); public static java.lang.String tr(java.lang.String self, java.lang.String sourceSet, java.lang.String replacementSet)
@java.lang.Deprecated public static void transformChar(java.io.Reader self, java.io.Writer writer, Closure closure)
@java.lang.Deprecated public static void transformLine(java.io.Reader reader, java.io.Writer writer, Closure closure)
public static java.util.List transpose(java.util.List self)
@java.lang.Deprecated} public static void traverse(java.io.File self, java.util.Map options, Closure closure)
@java.lang.Deprecated public static void traverse(java.io.File self, Closure closure)
@java.lang.Deprecated public static void traverse(java.io.File self, java.util.Map options)
public static float trunc(java.lang.Float number, int precision)
public static float trunc(java.lang.Float number)
public static double trunc(java.lang.Double number)
public static double trunc(java.lang.Double number, int precision)
self
- a Number
public static java.lang.Number unaryMinus(java.lang.Number left)
self
- a Floatto
- the end numberclosure
- the code to execute for each number
@java.lang.Deprecatedreturn IOGroovyMethods.leftShift(self, value); public static java.lang.CharSequence unexpand(java.lang.CharSequence self)
@java.lang.Deprecatedreturn ResourceGroovyMethods.newObjectOutputStream(file); public static java.lang.CharSequence unexpand(java.lang.CharSequence self, int tabStop)
@java.lang.Deprecatedreturn IOGroovyMethods.newObjectOutputStream(outputStream); public static java.lang.String unexpand(java.lang.String self)
@java.lang.Deprecatedreturn ResourceGroovyMethods.withObjectOutputStream(file, closure); public static java.lang.String unexpand(java.lang.String self, int tabStop)
@java.lang.Deprecatedreturn IOGroovyMethods.withObjectOutputStream(outputStream, closure); public static java.lang.CharSequence unexpandLine(java.lang.CharSequence self, int tabStop)
@java.lang.Deprecatedreturn ResourceGroovyMethods.newObjectInputStream(file); public static java.lang.String unexpandLine(java.lang.String self, int tabStop)
public static java.util.Iterator unique(java.util.Iterator self)
public static java.util.Collection unique(java.util.Collection self)
public static java.util.Collection unique(java.util.Collection self, boolean mutate)
public static java.util.Iterator unique(java.util.Iterator self, Closure closure)
public static java.util.Collection unique(java.util.Collection self, Closure closure)
public static java.util.Collection unique(java.util.Collection self, boolean mutate, Closure closure)
public static java.util.Iterator unique(java.util.Iterator self, java.util.Comparator comparator)
self
- an Iteratorcomparator
- a Comparator
public static java.util.Collection unique(java.util.Collection self, java.util.Comparator comparator)
public static java.util.Collection unique(java.util.Collection self, boolean mutate, java.util.Comparator comparator)
public static void upto(java.lang.Number self, java.lang.Number to, Closure closure)
public static void upto(long self, java.lang.Number to, Closure closure)
public static void upto(java.lang.Long self, java.lang.Number to, Closure closure)
public static void upto(float self, java.lang.Number to, Closure closure)
public static void upto(java.lang.Float self, java.lang.Number to, Closure closure)
public static void upto(double self, java.lang.Number to, Closure closure)
public static void upto(java.lang.Double self, java.lang.Number to, Closure closure)
self
- a Numberto
- another Number to go down toclosure
- the closure to call
public static void upto(java.math.BigInteger self, java.lang.Number to, Closure closure)
self
- a longto
- the end numberclosure
- the code to execute for each number
public static void upto(java.math.BigDecimal self, java.lang.Number to, Closure closure)
self
- a Longto
- the end numberclosure
- the code to execute for each number
public static java.lang.Object use(java.lang.Object self, java.lang.Class categoryClass, Closure closure)
self
- any ObjectcategoryClass
- a category class to useclosure
- the closure to invoke with the category in place
public static java.lang.Object use(java.lang.Object self, java.util.List categoryClassList, Closure closure)
public static java.lang.Object use(java.lang.Object self, java.lang.Object[] array)
public static java.lang.Object with(java.lang.Object self, Closure closure)
@java.lang.Deprecated} public static java.lang.Object withDataInputStream(java.io.File file, Closure closure)
@java.lang.Deprecated} public static java.lang.Object withDataOutputStream(java.io.File file, Closure closure)
public static java.util.Map withDefault(java.util.Map self, Closure init)
withLazyDefault
which decorates a list allowing
it to grow when called with index values outside the normal list bounds.
self
- a Listinit
- a Closure with the target index as parameter which generates the default value
public static java.util.List withDefault(java.util.List self, Closure init)
public static java.util.List withEagerDefault(java.util.List self, Closure init)
@java.lang.Deprecated} public static java.lang.Object withInputStream(java.io.File file, Closure closure)
@java.lang.Deprecated} public static java.lang.Object withInputStream(java.net.URL url, Closure closure)
public static java.util.List withLazyDefault(java.util.List self, Closure init)
@java.lang.Deprecated} public static java.lang.Object withObjectInputStream(java.io.File file, Closure closure)
@java.lang.Deprecated} public static java.lang.Object withObjectInputStream(java.io.File file, java.lang.ClassLoader classLoader, Closure closure)
@java.lang.Deprecated} public static java.lang.Object withObjectInputStream(java.io.InputStream inputStream, Closure closure)
@java.lang.Deprecated} public static java.lang.Object withObjectInputStream(java.io.InputStream inputStream, java.lang.ClassLoader classLoader, Closure closure)
@java.lang.Deprecated} public static java.lang.Object withObjectOutputStream(java.io.File file, Closure closure)
@java.lang.Deprecated} public static java.lang.Object withObjectOutputStream(java.io.OutputStream outputStream, Closure closure)
@java.lang.Deprecatedreturn ResourceGroovyMethods.eachLine(self, charset, closure); public static java.lang.Object withObjectStreams(java.net.Socket socket, Closure closure)
@java.lang.Deprecated} public static java.lang.Object withOutputStream(java.io.File file, Closure closure)
@java.lang.Deprecated} public static java.lang.Object withPrintWriter(java.io.File file, Closure closure)
@java.lang.Deprecated} public static java.lang.Object withPrintWriter(java.io.File file, java.lang.String charset, Closure closure)
@java.lang.Deprecated} public static java.lang.Object withPrintWriter(java.io.Writer writer, Closure closure)
@java.lang.Deprecated} public static java.lang.Object withReader(java.io.File file, Closure closure)
@java.lang.Deprecated} public static java.lang.Object withReader(java.io.File file, java.lang.String charset, Closure closure)
@java.lang.Deprecated} public static java.lang.Object withReader(java.io.Reader reader, Closure closure)
@java.lang.Deprecated} public static java.lang.Object withReader(java.net.URL url, Closure closure)
@java.lang.Deprecated} public static java.lang.Object withReader(java.net.URL url, java.lang.String charset, Closure closure)
@java.lang.Deprecated} public static java.lang.Object withReader(java.io.InputStream in, Closure closure)
@java.lang.Deprecated} public static java.lang.Object withReader(java.io.InputStream in, java.lang.String charset, Closure closure)
@java.lang.Deprecated} public static java.lang.Object withStream(java.io.InputStream stream, Closure closure)
@java.lang.Deprecated} public static java.lang.Object withStream(java.io.OutputStream os, Closure closure)
@java.lang.Deprecatedreturn ResourceGroovyMethods.eachLine(self, closure); public static java.lang.Object withStreams(java.net.Socket socket, Closure closure)
@java.lang.Deprecated} public static java.lang.Object withWriter(java.io.File file, Closure closure)
@java.lang.Deprecated} public static java.lang.Object withWriter(java.io.File file, java.lang.String charset, Closure closure)
@java.lang.Deprecated} public static java.lang.Object withWriter(java.io.Writer writer, Closure closure)
@java.lang.Deprecated} public static java.lang.Object withWriter(java.io.OutputStream stream, Closure closure)
@java.lang.Deprecated} public static java.lang.Object withWriter(java.io.OutputStream stream, java.lang.String charset, Closure closure)
@java.lang.Deprecated} public static java.lang.Object withWriterAppend(java.io.File file, java.lang.String charset, Closure closure)
@java.lang.Deprecated} public static java.lang.Object withWriterAppend(java.io.File file, Closure closure)
@java.lang.Deprecated} public static void write(java.io.Writer self, Writable writable)
@java.lang.Deprecatedreturn IOGroovyMethods.iterator(self); public static void write(java.io.File file, java.lang.String text)
@java.lang.Deprecatedthrows FileNotFoundException, UnsupportedEncodingException { public static void write(java.io.File file, java.lang.String text, java.lang.String charset)
@java.lang.Deprecatedreturn IOGroovyMethods.iterator(self); public static void writeLine(java.io.BufferedWriter writer, java.lang.String line)
public static java.util.BitSet xor(java.util.BitSet left, java.util.BitSet right)
public static java.lang.Number xor(java.lang.Number left, java.lang.Number right)
public static java.lang.Boolean xor(java.lang.Boolean left, java.lang.Boolean right)
Groovy Documentation