|
Groovy Documentation | |||||||
FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.codehaus.groovy.runtime.DefaultGroovyMethodsSupport org.codehaus.groovy.runtime.DefaultGroovyMethods
public class DefaultGroovyMethods extends DefaultGroovyMethodsSupport
This class defines new groovy methods which appear on normal JDK
classes inside the Groovy environment. Static methods are used with the
first parameter being the destination class,
i.e. public static String reverse(String self)
provides a reverse()
method for String
.
NOTE: While this class contains many 'public' static methods, it is primarily regarded as an internal class (its internal package name suggests this also). We value backwards compatibility of these methods when used within Groovy but value less backwards compatibility at the Java method call level. I.e. future versions of Groovy may remove or move a method call in this file but would normally aim to keep the method available from within Groovy.
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)
Truncate the value |
static float
|
abs(java.lang.Float number)
Determine if a Character is uppercase. |
static double
|
abs(java.lang.Double number)
|
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)
Coerce a collection instance to a boolean value. |
static boolean
|
asBoolean(java.lang.Boolean bool)
|
static boolean
|
asBoolean(java.util.Collection collection)
Coerce an iterator instance to a boolean value. |
static boolean
|
asBoolean(java.util.Map map)
Coerce an enumeration instance to a boolean value. |
static boolean
|
asBoolean(java.util.Iterator iterator)
Coerce an Object array to a boolean value. |
static boolean
|
asBoolean(java.util.Enumeration enumeration)
Coerces a byte array to a boolean value. |
static boolean
|
asBoolean(java.lang.Object[] array)
Coerces a short array to a boolean value. |
static boolean
|
asBoolean(byte[] array)
Coerces an int array to a boolean value. |
static boolean
|
asBoolean(short[] array)
Coerces a long array to a boolean value. |
static boolean
|
asBoolean(int[] array)
Coerces a float array to a boolean value. |
static boolean
|
asBoolean(long[] array)
Coerces a double array to a boolean value. |
static boolean
|
asBoolean(float[] array)
Coerces a boolean array to a boolean value. |
static boolean
|
asBoolean(double[] array)
Coerces a char array to a boolean value. |
static boolean
|
asBoolean(boolean[] array)
Coerce a character to a boolean value. |
static boolean
|
asBoolean(char[] array)
Coerce a number to a boolean value. |
static boolean
|
asBoolean(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 sorted map. |
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)
Coerce an object 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)
|
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)
|
static java.util.Map
|
collectEntries(java.util.Collection self, Closure transform)
A variant of collectEntries for Iterators. |
static java.util.Map
|
collectEntries(java.util.Iterator self, Closure transform)
A variant of collectEntries for Iterables. |
static java.util.Map
|
collectEntries(java.lang.Iterable self, Closure transform)
|
static java.util.Map
|
collectEntries(java.util.Collection self)
A variant of collectEntries for Iterators using the identity closure as the transform. |
static java.util.Map
|
collectEntries(java.util.Iterator self)
A variant of collectEntries for Iterables using the identity closure as the transform. |
static java.util.Map
|
collectEntries(java.lang.Iterable self)
|
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)
A variant of collectEntries for Iterables using a supplied map as the destination of transformed entries. |
static java.util.Map
|
collectEntries(java.lang.Iterable self, java.util.Map collector, Closure transform)
A variant of collectEntries for Collections using the identity closure as the transform and a supplied map as the destination of transformed entries. |
static java.util.Map
|
collectEntries(java.util.Collection self, java.util.Map collector)
A variant of collectEntries for Iterators using the identity closure as the transform and a supplied map as the destination of transformed entries. |
static 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)
Projects each item from a source collection to a collection and concatenates (flattens) the resulting collections into a single list. |
static java.util.Collection
|
collectMany(java.util.Collection self, java.util.Collection collector, 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)
Deprecated alias for collectNested |
static java.util.Collection
|
collectNested(java.util.Collection self, java.util.Collection collector, Closure transform)
|
static java.util.List
|
combinations(java.util.Collection self)
Finds all non-null subsequences of a list. |
static int
|
compareTo(java.lang.Character left, java.lang.Number right)
|
static int
|
compareTo(java.lang.Number left, java.lang.Character right)
|
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)
Checks whether the array contains the given 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)
|
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)
Returns the string representation of the given map. |
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)
|
static java.lang.Number
|
count(java.util.Collection 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 which satisfy the given closure from 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)
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)
Bitwise AND together two BitSets. |
static java.lang.Number
|
div(java.lang.Character left, java.lang.Character right)
Bitwise XOR together two BitSets. |
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)
|
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)
Iterates from this number up to the given number using a step increment. |
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)
|
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)
|
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)
|
static java.lang.Object[]
|
dropWhile(java.lang.Object[] self, Closure condition)
|
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
|
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. |
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)
|
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)
|
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.util.Map self, Closure filteringTransform)
|
static java.lang.Object
|
first(java.util.List self)
|
static java.lang.Object
|
first(java.lang.Iterable self)
Returns the first item from the array. |
static java.lang.Object
|
first(java.lang.Object[] self)
|
static java.util.Collection
|
flatten(java.util.Collection self)
Flatten an array. |
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)
Flatten a collection. |
static java.util.Collection
|
flatten(double[] self)
|
static java.util.Collection
|
flatten(java.util.Collection self, Closure flattenUsing)
Overloads the left shift operator to provide an easy way to append objects to a Collection. |
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)
Support the range subscript operator for a List. |
static java.util.List
|
getAt(java.util.List self, EmptyRange range)
Select a List of items from a List using a Collection to identify the indices to be selected. |
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)
|
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.util.Map self, java.lang.Object key)
Support the subscript operator for a Map. |
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)
Sets/updates the metaclass for a given object to a closure. |
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.util.Collection self, java.lang.Object... closures)
|
static java.util.Map
|
groupBy(java.util.Collection self, java.util.List closures)
Sorts all collection members into (sub)groups determined by the supplied mapping 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)
|
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)
Sums the items in a collection. |
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)
Bitwise NEGATE a BitSet. |
static java.lang.Number
|
intdiv(java.lang.Number left, java.lang.Character right)
Bitwise OR together two BitSets. |
static java.lang.Number
|
intdiv(java.lang.Character left, java.lang.Character right)
Bitwise XOR together two Numbers. |
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)
|
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)
Concatenates the |
static java.lang.String
|
join(java.util.Collection 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)
Returns the first item from the List. |
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.util.Iterator self)
|
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.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)
Selects the maximum value found in the collection using the given comparator. |
static java.lang.Object
|
max(java.util.Collection self, java.util.Comparator 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 Iterator objects. |
static java.lang.Object
|
min(java.util.Iterator self)
|
static java.lang.Object
|
min(java.lang.Object[] self)
|
static java.lang.Object
|
min(java.util.Collection self, java.util.Comparator comparator)
|
static java.lang.Object
|
min(java.util.Iterator self, java.util.Comparator comparator)
|
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.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)
Adds max() method to Collection objects. |
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)
Create an array composed of the elements of the first array minus the elements of the given array. |
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)
Flatten an array. |
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)
Power of a Number to a certain exponent. |
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)
Power of an integer to an integer certain exponent. |
static java.lang.Number
|
multiply(java.math.BigDecimal left, java.lang.Double right)
|
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)
Sets the metaclass for a given class. |
static java.lang.Object
|
newInstance(java.lang.Class c, java.lang.Object[] args)
Sets/updates the metaclass for a given class to a closure. |
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)
|
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)
|
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.Map
|
plus(java.util.Map left, java.util.Map right)
A helper method to allow maps to work with subscript operators |
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)
|
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)
|
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)
|
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)
Integer Divide a Number by a Character. |
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)
|
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)
A helper method to allow lists to work with subscript operators. |
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)
|
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)
Modifies this collection so that it retains only its elements that are contained in the specified array. |
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)
Modifies this collection so that it retains only its elements that are matched according to the specified closure condition. |
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)
Creates a new array containing items which are the same as this array but in reverse order. |
static java.lang.Object[]
|
reverse(java.lang.Object[] self)
|
static java.lang.Object[]
|
reverse(java.lang.Object[] self, boolean mutate)
|
static java.util.Iterator
|
reverse(java.util.Iterator self)
|
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)
Converts the character to uppercase. |
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)
|
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)
Converts this array to a List of the same size, with each element added to the list. |
static int
|
size(short[] array)
Converts this array to a List of the same size, with each element added to the list. |
static int
|
size(int[] array)
|
static int
|
size(long[] array)
|
static int
|
size(float[] array)
|
static int
|
size(double[] array)
|
static int
|
size(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.util.Collection self, boolean mutate)
Sorts the elements from the given map into a new ordered map using the closure as a comparator to determine the ordering. |
static java.util.Map
|
sort(java.util.Map self, Closure closure)
|
static java.util.Map
|
sort(java.util.Map self, java.util.Comparator comparator)
|
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. |
static java.util.Iterator
|
sort(java.util.Iterator self)
|
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)
|
static java.util.List
|
sort(java.util.Collection self, boolean mutate, java.util.Comparator comparator)
Sorts the given array into sorted order using the given 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)
Sorts the given iterator items into a sorted iterator using the Closure to determine the correct ordering. |
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)
|
static java.util.List
|
sort(java.util.Collection self, Closure closure)
|
static java.util.List
|
sort(java.util.Collection self, boolean mutate, Closure closure)
Avoids doing unnecessary work when sorting an already sorted set (i.e. an identity function for an already sorted set). |
static java.util.SortedSet
|
sort(java.util.SortedSet self)
Removes the last item from the List. |
static java.util.SortedMap
|
sort(java.util.SortedMap self)
|
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)
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)
Sums the items in an array. |
static java.lang.Object
|
sum(java.lang.Object[] self)
|
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.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 array. |
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.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)
Returns the first |
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)
|
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)
|
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)
Logical disjunction of two boolean operators |
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)
Logical conjunction of two boolean operators. |
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)
Converts this array to a Set, with each unique element added to the set. |
static java.util.List
|
toList(boolean[] array)
Converts this array to a Set, with each unique element added to the set. |
static java.util.List
|
toList(char[] array)
Converts this array to a Set, with each unique element added to the set. |
static java.util.List
|
toList(short[] array)
Converts this array to a Set, with each unique element added to the set. |
static java.util.List
|
toList(int[] array)
Converts this array to a Set, with each unique element added to the set. |
static java.util.List
|
toList(long[] array)
Converts this array to a Set, with each unique element added to the set. |
static java.util.List
|
toList(float[] array)
Converts this array to a Set, with each unique element added to the set. |
static java.util.List
|
toList(double[] array)
Converts this array to a Set, with each unique element added to the set. |
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)
Increment a Character by one. |
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)
Implements the getAt(int) method for primitive type arrays. |
static java.util.Set
|
toSet(long[] array)
Implements the getAt(Range) method for primitive type arrays. |
static java.util.Set
|
toSet(float[] array)
|
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)
|
static java.util.Set
|
toSet(java.util.Enumeration self)
|
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)
Returns the string representation of the given list. |
static java.lang.String
|
toString(int[] self)
|
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)
|
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)
|
static java.lang.Number
|
unaryMinus(java.lang.Number left)
|
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)
Iterates from this number up to the given number, inclusive, incrementing by one each time. |
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)
Sorts the Collection. |
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), java.lang.Object#wait(long, int), 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)
number
- a Doubleprecision
- the number of decimal places to keep
public static float abs(java.lang.Float number)
self
- a Character
public static double abs(java.lang.Double number)
public static java.net.Socket accept(java.net.ServerSocket serverSocket, Closure 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)
} public static void append(java.io.File file, java.lang.Object text)
} public static void append(java.io.File file, byte[] bytes)
} public static void append(java.io.File self, java.io.InputStream stream)
} public static void append(java.io.File file, java.lang.Object text, java.lang.String charset)
public static boolean asBoolean(java.lang.Object object)
assert [1,2].asBoolean() == true
assert [].asBoolean() == false
collection
- the collection
public static boolean asBoolean(java.lang.Boolean bool)
public static boolean asBoolean(java.util.Collection collection)
iterator
- the iterator
public static boolean asBoolean(java.util.Map map)
enumeration
- the enumeration
public static boolean asBoolean(java.util.Iterator iterator)
array
- the array
public static boolean asBoolean(java.util.Enumeration enumeration)
array
- an array
public static boolean asBoolean(java.lang.Object[] array)
array
- an array
public static boolean asBoolean(byte[] array)
array
- an array
public static boolean asBoolean(short[] array)
array
- an array
public static boolean asBoolean(int[] array)
array
- an array
public static boolean asBoolean(long[] array)
array
- an array
public static boolean asBoolean(float[] array)
array
- an array
public static boolean asBoolean(double[] array)
array
- an array
public static boolean asBoolean(boolean[] array)
character
- the character
public static boolean asBoolean(char[] array)
number
- the number
public static boolean asBoolean(java.lang.Character character)
public static boolean asBoolean(java.lang.Number number)
@Deprecated public static boolean asBoolean(java.lang.CharSequence string)
@Deprecated public static boolean asBoolean(java.util.regex.Matcher matcher)
public static java.util.Map asImmutable(java.util.Map self)
self
- a SortedMap
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
public static java.util.List asList(java.util.Collection self)
object
- the object to coerce
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)
} catch (GroovyCastException e) { public static java.lang.Object asType(java.util.Collection col, java.lang.Class clazz)
} public static java.lang.Object asType(java.lang.Object[] ary, java.lang.Class clazz)
ary
- an arrayclazz
- the desired class
if (!(clazz.isInstance(map)) && clazz.isInterface()) { public static java.lang.Object asType(Closure cl, java.lang.Class clazz)
map
- this mapclazz
- the target type
* @since 1.0 public static java.lang.Object asType(java.util.Map map, java.lang.Class clazz)
* Traverse through each byte of this byte array. Alias for each. public static java.lang.Object asType(java.lang.Number self, java.lang.Class c)
self
- a Byte arrayclosure
- a closure
if (mc instanceof ExpandoMetaClass 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
@Deprecated public static java.lang.Object asType(java.lang.CharSequence self, java.lang.Class c)
@Deprecated public static String eachMatch(String self, String regex, Closure closure) { public static java.lang.Object asType(GString self, java.lang.Class c)
public static CharSequence expand(CharSequence self) { return StringGroovyMethods.expand(self); public static java.lang.Object asType(java.lang.String self, java.lang.Class c)
public static java.lang.Object asType(java.io.File f, java.lang.Class c)
public static java.io.File asWritable(java.io.File file)
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
return StringGroovyMethods.expand(self, tabStop); public static java.util.regex.Pattern bitwiseNegate(java.lang.CharSequence self)
return StringGroovyMethods.expand(self); 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)
return StringGroovyMethods.expand(self, tabStop); public static java.lang.CharSequence capitalize(java.lang.CharSequence self)
return StringGroovyMethods.expandLine(self, tabStop); public static java.lang.String capitalize(java.lang.String self)
return StringGroovyMethods.expandLine(self, tabStop); public static java.lang.CharSequence center(java.lang.CharSequence self, java.lang.Number numberOfChars)
return StringGroovyMethods.find(self, regex); public static java.lang.CharSequence center(java.lang.CharSequence self, java.lang.Number numberOfChars, java.lang.CharSequence padding)
return StringGroovyMethods.find(self, regex, closure); public static java.lang.String center(java.lang.String self, java.lang.Number numberOfChars)
return StringGroovyMethods.find(self, pattern); 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)
public static java.util.Map collectEntries(java.util.Collection self, Closure transform)
self
- an Iteratortransform
- the closure used for transforming, which has an item from self as the parameter and
should return a Map.Entry, a Map or a two-element list containing the resulting key and value
public static java.util.Map collectEntries(java.util.Iterator self, Closure transform)
self
- an Iterabletransform
- the closure used for transforming, which has an item from self as the parameter and
should return a Map.Entry, a Map or a two-element list containing the resulting key and value
public static java.util.Map collectEntries(java.lang.Iterable self, Closure transform)
public static java.util.Map collectEntries(java.util.Collection self)
self
- an Iterator
public static java.util.Map collectEntries(java.util.Iterator self)
self
- an Iterable
public static java.util.Map collectEntries(java.lang.Iterable self)
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)
self
- an Iterablecollector
- the Map into which the transformed entries are puttransform
- the closure used for transforming, which has an item from self as the parameter and
should return a Map.Entry, a Map or a two-element list containing the resulting key and value
public static java.util.Map collectEntries(java.lang.Iterable self, java.util.Map collector, Closure transform)
self
- a Collectioncollector
- the Map into which the transformed entries are put
public static java.util.Map collectEntries(java.util.Collection self, java.util.Map collector)
self
- an Iteratorcollector
- the Map into which the transformed entries are put
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)
public static java.util.List collectMany(java.util.Collection self, Closure projection)
def nums = 1..10 def squaresAndCubesOfEvens = nums.collectMany{ it % 2 ? [] : [it**2, it**3] } assert squaresAndCubesOfEvens == [4, 8, 16, 64, 36, 216, 64, 512, 100, 1000] def animals = ['CAT', 'DOG', 'ELEPHANT'] as Set def smallAnimals = animals.collectMany{ it.size() > 3 ? [] : [it.toLowerCase()] } assert smallAnimals == ['cat', 'dog'] def orig = nums as Set def origPlusIncrements = orig.collectMany{ [it, it+1] } assert origPlusIncrements.size() == orig.size() * 2 assert origPlusIncrements.unique().size() == orig.size() + 1
self
- a collectionprojection
- a projecting Closure returning a collection of items
public static java.util.Collection collectMany(java.util.Collection self, java.util.Collection collector, 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.Collection collectNested(java.util.Collection self, java.util.Collection collector, Closure transform)
public static java.util.List combinations(java.util.Collection self)
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
public static int compareTo(java.lang.Character left, java.lang.Number right)
public static int compareTo(java.lang.Number left, java.lang.Character right)
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)
self
- the array we are searchingvalue
- the value being searched for
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)
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)
self
- a Map
return StringGroovyMethods.find(self, pattern, closure); public static boolean contains(java.lang.CharSequence self, java.lang.CharSequence text)
return StringGroovyMethods.find(self, pattern); 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
public static java.lang.Number count(java.util.Collection self, java.lang.Object value)
public static java.lang.Number count(java.util.Collection 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)
self
- the array within which we count the number of occurrencesclosure
- a closure condition
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)
return StringGroovyMethods.find(self, pattern, closure); public static int count(java.lang.CharSequence self, java.lang.CharSequence text)
return StringGroovyMethods.find(self, regex); public static int count(java.lang.String self, java.lang.String text)
public static java.util.Map countBy(java.util.Collection 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
return StringGroovyMethods.find(self, regex, closure); protected static StringBufferWriter createStringBufferWriter(java.lang.StringBuffer self)
return StringGroovyMethods.findAll(self, regex); protected static java.io.StringWriter createStringWriter(java.lang.String self)
public static boolean deleteDir(java.io.File self)
public static java.lang.CharSequence denormalize(java.lang.CharSequence self)
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)
left
- a BitSetright
- another BitSet to bitwise AND
public static java.lang.Number div(java.lang.Character left, java.lang.Character right)
left
- a BitSetright
- another BitSet to bitwise AND
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)
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)
0.step( 10, 2 ) { println it }Prints even numbers 0 through 8.
self
- a Number to start withto
- a Number to go up to, exclusivestepNumber
- a Number representing the step incrementclosure
- the closure to call
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)
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)
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
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)
public static java.lang.Object[] dropWhile(java.lang.Object[] self, Closure condition)
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)
public static void eachByte(java.io.File self, Closure closure)
public static void eachByte(java.io.File self, int bufferLen, Closure closure)
public static void eachByte(java.io.InputStream is, Closure closure)
public static void eachByte(java.io.InputStream is, int bufferLen, Closure closure)
public static void eachByte(java.net.URL url, Closure closure)
public static void eachByte(java.net.URL url, int bufferLen, Closure closure)
public static void eachDir(java.io.File self, Closure closure)
public static void eachDirMatch(java.io.File self, java.lang.Object nameFilter, Closure closure)
return ResourceGroovyMethods.newWriter(file, append); public static void eachDirRecurse(java.io.File self, Closure closure)
} public static void eachFile(java.io.File self, FileType fileType, Closure closure)
public static void eachFile(java.io.File self, Closure closure)
return ResourceGroovyMethods.newWriter(file, charset, append); public static void eachFileMatch(java.io.File self, FileType fileType, java.lang.Object nameFilter, Closure closure)
} public static void eachFileMatch(java.io.File self, java.lang.Object nameFilter, Closure closure)
public static void eachFileRecurse(java.io.File self, FileType fileType, Closure closure)
return ResourceGroovyMethods.newWriter(file); public static void eachFileRecurse(java.io.File self, Closure closure)
@Deprecated public static java.lang.Object eachLine(java.lang.CharSequence self, Closure closure)
@Deprecated public static java.lang.Object eachLine(java.lang.CharSequence self, int firstLine, Closure closure)
@Deprecated public static java.lang.Object eachLine(java.lang.String self, Closure closure)
@Deprecated public static java.lang.Object eachLine(java.lang.String self, int firstLine, Closure closure)
@Deprecated public static java.lang.Object eachLine(java.io.File self, Closure closure)
@Deprecated public static java.lang.Object eachLine(java.io.File self, java.lang.String charset, Closure closure)
@Deprecated public static java.lang.Object eachLine(java.io.File self, int firstLine, Closure closure)
@Deprecated public static java.lang.Object eachLine(java.io.File self, java.lang.String charset, int firstLine, Closure closure)
@Deprecated public static java.lang.Object eachLine(java.io.InputStream stream, java.lang.String charset, Closure closure)
@Deprecated public static java.lang.Object eachLine(java.io.InputStream stream, java.lang.String charset, int firstLine, Closure closure)
@Deprecated public static java.lang.Object eachLine(java.io.InputStream stream, Closure closure)
@Deprecated public static java.lang.Object eachLine(java.io.InputStream stream, int firstLine, Closure closure)
@Deprecated public static java.lang.Object eachLine(java.net.URL url, Closure closure)
@Deprecated public static java.lang.Object eachLine(java.net.URL url, int firstLine, Closure closure)
@Deprecated public static java.lang.Object eachLine(java.net.URL url, java.lang.String charset, Closure closure)
@Deprecated public static java.lang.Object eachLine(java.net.URL url, java.lang.String charset, int firstLine, Closure closure)
@Deprecated public static java.lang.Object eachLine(java.io.Reader self, Closure closure)
@Deprecated public static java.lang.Object eachLine(java.io.Reader self, int firstLine, Closure closure)
@Deprecated public static java.lang.String eachMatch(java.lang.CharSequence self, java.lang.CharSequence regex, Closure closure)
@Deprecated public static java.lang.String eachMatch(java.lang.CharSequence self, java.util.regex.Pattern pattern, Closure closure)
@Deprecated public static java.lang.String eachMatch(java.lang.String self, java.util.regex.Pattern pattern, Closure closure)
@Deprecated public static java.lang.String eachMatch(java.lang.String self, java.lang.String regex, Closure closure)
@Deprecated public static void eachObject(java.io.File self, Closure closure)
@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)
public static java.lang.Process execute(java.lang.String self)
public static java.lang.Process execute(java.lang.String self, java.lang.String[] envp, java.io.File dir)
public static java.lang.Process execute(java.lang.String self, java.util.List envp, java.io.File dir)
public static java.lang.Process execute(java.lang.String[] commandArray)
public static java.lang.Process execute(java.lang.String[] commandArray, java.lang.String[] envp, java.io.File dir)
public static java.lang.Process execute(java.lang.String[] commandArray, java.util.List envp, java.io.File dir)
public static java.lang.Process execute(java.util.List commands)
public static java.lang.Process execute(java.util.List commands, java.lang.String[] envp, java.io.File dir)
public static java.lang.Process execute(java.util.List commands, java.util.List envp, java.io.File dir)
@Deprecated public static java.lang.CharSequence expand(java.lang.CharSequence self)
@Deprecated public static java.lang.CharSequence expand(java.lang.CharSequence self, int tabStop)
@Deprecated public static java.lang.String expand(java.lang.String self)
@Deprecated public static java.lang.String expand(java.lang.String self, int tabStop)
@Deprecated public static java.lang.CharSequence expandLine(java.lang.CharSequence self, int tabStop)
@Deprecated public static java.lang.String expandLine(java.lang.String self, int tabStop)
public static void filterLine(java.io.Reader reader, java.io.Writer writer, Closure closure)
public static Writable filterLine(java.io.File self, Closure closure)
public static Writable filterLine(java.io.File self, java.lang.String charset, Closure closure)
public static void filterLine(java.io.File self, java.io.Writer writer, Closure closure)
public static void filterLine(java.io.File self, java.io.Writer writer, java.lang.String charset, Closure closure)
public static Writable filterLine(java.io.Reader reader, Closure closure)
public static Writable filterLine(java.io.InputStream self, Closure predicate)
public static Writable filterLine(java.io.InputStream self, java.lang.String charset, Closure predicate)
public static void filterLine(java.io.InputStream self, java.io.Writer writer, Closure predicate)
public static void filterLine(java.io.InputStream self, java.io.Writer writer, java.lang.String charset, Closure predicate)
public static Writable filterLine(java.net.URL self, Closure predicate)
public static Writable filterLine(java.net.URL self, java.lang.String charset, Closure predicate)
public static void filterLine(java.net.URL self, java.io.Writer writer, Closure predicate)
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)
@Deprecated public static java.lang.CharSequence find(java.lang.CharSequence self, java.lang.CharSequence regex)
@Deprecated public static java.lang.CharSequence find(java.lang.CharSequence self, java.lang.CharSequence regex, Closure closure)
@Deprecated public static java.lang.CharSequence find(java.lang.CharSequence self, java.util.regex.Pattern pattern)
@Deprecated public static java.lang.CharSequence find(java.lang.CharSequence self, java.util.regex.Pattern pattern, Closure closure)
@Deprecated public static java.lang.String find(java.lang.String self, java.util.regex.Pattern pattern)
@Deprecated public static java.lang.String find(java.lang.String self, java.util.regex.Pattern pattern, Closure closure)
@Deprecated public static java.lang.String find(java.lang.String self, java.lang.String regex)
@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)
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)
@Deprecated public static java.util.List findAll(java.lang.CharSequence self, java.lang.CharSequence regex)
@Deprecated public static java.util.List findAll(java.lang.CharSequence self, java.lang.CharSequence regex, Closure closure)
@Deprecated public static java.util.List findAll(java.lang.CharSequence self, java.util.regex.Pattern pattern)
@Deprecated public static java.util.List findAll(java.lang.CharSequence self, java.util.regex.Pattern pattern, Closure closure)
@Deprecated public static java.util.List findAll(java.lang.String self, java.util.regex.Pattern pattern)
@Deprecated public static java.util.List findAll(java.lang.String self, java.util.regex.Pattern pattern, Closure closure)
@Deprecated public static java.util.List findAll(java.lang.String self, java.lang.String regex)
@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)
public static java.util.Collection findResults(java.util.Collection 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)
def array = [3, 4, 2].toArray() assert array.first() == 3
self
- an array
public static java.lang.Object first(java.lang.Object[] self)
public static java.util.Collection flatten(java.util.Collection self)
self
- a byte Array to flatten
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)
self
- a CollectionflattenUsing
- a closure to determine how to flatten non-Array, non-Collection elements
public static java.util.Collection flatten(double[] self)
public static java.util.Collection flatten(java.util.Collection self, Closure flattenUsing)
def list = [1,2] list << 3 assert list == [1,2,3]
self
- a Collectionvalue
- an Object to be added to the collection.
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 = [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)
def list = [true, 1, 3.4, false] assert list[1,0,2] == [1, true, 3.4]
self
- a Listindices
- a Collection of indices
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)
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.util.Map self, java.lang.Object key)
def map = [a:10] assert map["a"] == 10
self
- a Mapkey
- an Object as a key for the map
public static java.util.List getAt(java.util.Collection coll, java.lang.String property)
self
- a Map
* Support the subscript operator with a range for a long array public static java.util.List getAt(byte[] array, Range range)
array
- an int arrayrange
- a range indicating the indices for the items to retrieve
* Support the subscript operator with a range for a float array public static java.util.List getAt(char[] array, Range range)
* Support the subscript operator with a range for a double array public static java.util.List getAt(short[] array, Range range)
* Support the subscript operator with a range for a boolean array public static java.util.List getAt(int[] array, Range range)
* Support the subscript operator with an IntRange for a byte array public static java.util.List getAt(long[] array, Range range)
* Support the subscript operator with an IntRange for a char array public static java.util.List getAt(float[] array, Range range)
* Support the subscript operator with an IntRange for a short array public static java.util.List getAt(double[] array, Range range)
* Support the subscript operator with an IntRange for an int array public static java.util.List getAt(boolean[] array, Range range)
* Support the subscript operator with an IntRange for a long array public static java.util.List getAt(byte[] array, IntRange range)
* Support the subscript operator with an IntRange for a float array public static java.util.List getAt(char[] array, IntRange range)
* Support the subscript operator with an IntRange for a double array public static java.util.List getAt(short[] array, IntRange range)
* Support the subscript operator with an IntRange for a boolean array public static java.util.List getAt(int[] array, IntRange range)
* Support the subscript operator with an ObjectRange for a byte array public static java.util.List getAt(long[] array, IntRange range)
* Support the subscript operator with an ObjectRange for a char array public static java.util.List getAt(float[] array, IntRange range)
* Support the subscript operator with an ObjectRange for a short array public static java.util.List getAt(double[] array, IntRange range)
* Support the subscript operator with an ObjectRange for an int array public static java.util.List getAt(boolean[] array, IntRange range)
* Support the subscript operator with an ObjectRange for a long array public static java.util.List getAt(byte[] array, ObjectRange range)
* Support the subscript operator with an ObjectRange for a float array public static java.util.List getAt(char[] array, ObjectRange range)
* Support the subscript operator with an ObjectRange for a double array public static java.util.List getAt(short[] array, ObjectRange range)
* Support the subscript operator with an ObjectRange for a byte array public static java.util.List getAt(int[] array, ObjectRange range)
* Support the subscript operator with a collection for a byte array public static java.util.List getAt(long[] array, ObjectRange range)
* Support the subscript operator with a collection for a char array public static java.util.List getAt(float[] array, ObjectRange range)
* Support the subscript operator with a collection for a short array public static java.util.List getAt(double[] array, ObjectRange range)
* Support the subscript operator with a collection for an int array public static java.util.List getAt(boolean[] array, ObjectRange range)
* Support the subscript operator with a collection for a long array public static java.util.List getAt(byte[] array, java.util.Collection indices)
* Support the subscript operator with a collection for a float array public static java.util.List getAt(char[] array, java.util.Collection indices)
* Support the subscript operator with a collection for a double array public static java.util.List getAt(short[] array, java.util.Collection indices)
* Support the subscript operator with a collection for a boolean array public static java.util.List getAt(int[] array, java.util.Collection indices)
* Support the subscript operator for a Bitset public static java.util.List getAt(long[] array, java.util.Collection indices)
* Support retrieving a subset of a BitSet using a Range public static java.util.List getAt(float[] array, java.util.Collection indices)
BitSet result = new BitSet(); public static java.util.List getAt(double[] array, java.util.Collection indices)
} 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)
@Deprecated public static java.lang.CharSequence getAt(java.lang.CharSequence self, java.util.Collection indices)
@Deprecated public static java.lang.CharSequence getAt(java.lang.CharSequence text, EmptyRange range)
@Deprecated public static java.lang.CharSequence getAt(java.lang.CharSequence text, int index)
@Deprecated public static java.lang.CharSequence getAt(java.lang.CharSequence text, IntRange range)
@Deprecated public static java.lang.CharSequence getAt(java.lang.CharSequence text, Range range)
@Deprecated public static java.util.List getAt(java.util.regex.Matcher self, java.util.Collection indices)
@Deprecated public static java.lang.Object getAt(java.util.regex.Matcher matcher, int idx)
@Deprecated public static java.lang.String getAt(java.lang.String self, java.util.Collection indices)
@Deprecated public static java.lang.String getAt(java.lang.String text, EmptyRange range)
@Deprecated public static java.lang.String getAt(java.lang.String text, int index)
@Deprecated public static java.lang.String getAt(java.lang.String text, IntRange range)
@Deprecated public static java.lang.String getAt(java.lang.String text, Range range)
public static void eachFileMatch(final File self, final FileType fileType, final Object nameFilter, final Closure closure) public static byte[] getBytes(java.io.File file)
@Deprecated public static byte[] getBytes(java.net.URL url)
public static byte[] getBytes(java.io.InputStream is)
@Deprecated public static char[] getChars(java.lang.CharSequence self)
@Deprecated public static char[] getChars(java.lang.String self)
@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)
self
- the object whose metaclass we wish to updateclosure
- the closure representing the new metaclass
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)
@Deprecated public static java.lang.String getText(java.io.File file, java.lang.String charset)
public static java.lang.String getText(java.io.File file)
public static java.lang.String getText(java.net.URL url)
public static java.lang.String getText(java.net.URL url, java.util.Map parameters)
} public static java.lang.String getText(java.net.URL url, java.lang.String charset)
ResourceGroovyMethods.traverse(self, options, closure); public static java.lang.String getText(java.net.URL url, java.util.Map parameters, java.lang.String charset)
ResourceGroovyMethods.traverse(self, closure); public static java.lang.String getText(java.io.InputStream is)
throws FileNotFoundException, IllegalArgumentException { public static java.lang.String getText(java.io.InputStream is, java.lang.String charset)
public static void eachFileRecurse(File self, Closure closure) throws FileNotFoundException, IllegalArgumentException { public static java.lang.String getText(java.io.Reader reader)
public static void eachDirRecurse(final File self, final Closure closure) throws FileNotFoundException, IllegalArgumentException { 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)
* assert items.grep() == [1, 2, true, 'foo', [4, 5]] public static java.util.Collection grep(java.util.Collection self)
* @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)
public static java.util.Map groupBy(java.util.Collection self, Closure closure)
public static java.util.Map groupBy(java.util.Collection self, java.lang.Object... closures)
public static java.util.Map groupBy(java.util.Collection self, java.util.List closures)
Example usage:
def result = [1,2,3,4,5,6].groupBy([{ it % 2 }, { it < 4 }]) assert result == [1:[(true):[1, 3], (false):[5]], 0:[(true):[2], (false):[4, 6]]]Another example:
def sql = groovy.sql.Sql.newInstance(/* ... */) def data = sql.rows("SELECT * FROM a_table").groupBy([{ it.column1 }, { it.column2 }, { it.column3 }]) if (data.val1.val2.val3) { // there exists a record where: // a_table.column1 == val1 // a_table.column2 == val2, and // a_table.column3 == val3 } else { // there is no such record }If an empty list of closures is supplied the IDENTITY Closure will be used.
self
- a collection to groupclosures
- a list of closures, each mapping entries on keys
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)
If the self
map is one of TreeMap, Hashtable, or Properties,
the returned Map will preserve that type, otherwise a LinkedHashMap will
be returned.
def result = [a:1,b:2,c:3,d:4,e:5,f:6].groupBy([{ it.value % 2 }, { it.key.next() }]) assert result == [1:[b:[a:1], d:[c:3], f:[e:5]], 0:[c:[b:2], e:[d:4], g:[f:6]]]If an empty list of closures is supplied the IDENTITY Closure will be used.
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)
@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)
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)
assert 1+2+3+4 == [1,2,3,4].sum()
self
- Collection of values to add together
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)
self
- a BitSet
public static java.lang.Number intdiv(java.lang.Number left, java.lang.Character right)
left
- a BitSetright
- another BitSet to bitwise AND
public static java.lang.Number intdiv(java.lang.Character left, java.lang.Character right)
left
- a Numberright
- another Number to bitwse XOR
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
@Deprecated public static boolean isAllWhitespace(java.lang.CharSequence self)
@Deprecated public static boolean isAllWhitespace(java.lang.String self)
@Deprecated public static boolean isBigDecimal(java.lang.CharSequence self)
@Deprecated public static boolean isBigDecimal(java.lang.String self)
@Deprecated public static boolean isBigInteger(java.lang.CharSequence self)
@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)
@Deprecated public static boolean isCase(java.lang.CharSequence caseValue, java.lang.Object switchValue)
@Deprecated public static boolean isCase(GString caseValue, java.lang.Object switchValue)
@Deprecated public static boolean isCase(java.util.regex.Pattern caseValue, java.lang.Object switchValue)
@Deprecated public static boolean isCase(java.lang.String caseValue, java.lang.Object switchValue)
public static boolean isDigit(java.lang.Character self)
@Deprecated public static boolean isDouble(java.lang.CharSequence self)
@Deprecated public static boolean isDouble(java.lang.String self)
@Deprecated public static boolean isFloat(java.lang.CharSequence self)
@Deprecated public static boolean isFloat(java.lang.String self)
@Deprecated public static boolean isInteger(java.lang.CharSequence self)
@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
@Deprecated public static boolean isLong(java.lang.CharSequence self)
@Deprecated public static boolean isLong(java.lang.String self)
public static boolean isLowerCase(java.lang.Character self)
self
- a Number
@Deprecated public static boolean isNumber(java.lang.CharSequence self)
@Deprecated public static boolean isNumber(java.lang.String self)
public static boolean isUpperCase(java.lang.Character self)
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)
@Deprecated public static java.util.Iterator iterator(java.util.regex.Matcher matcher)
public static java.util.Iterator iterator(java.io.Reader self)
public static java.util.Iterator iterator(java.io.InputStream self)
public static java.util.Iterator iterator(java.io.DataInputStream self)
public static java.lang.String join(java.util.Iterator self, java.lang.String separator)
toString()
representation of each
item in this collection, with the given String as a separator between
each item.
assert "1, 2, 3" == [1,2,3].join(", ")
self
- a Collection of objectsseparator
- a String separator
public static java.lang.String join(java.util.Collection 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)
def list = [3, 4, 2] assert list.first() == 3 // check original is unaltered assert list == [3, 4, 2]
self
- a List
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
@Deprecated public static java.lang.StringBuilder leftShift(java.lang.CharSequence self, java.lang.Object value)
@Deprecated public static java.lang.StringBuffer leftShift(java.lang.String self, java.lang.Object value)
@Deprecated public static java.lang.StringBuffer leftShift(java.lang.StringBuffer self, java.lang.Object value)
@Deprecated public static java.lang.StringBuilder leftShift(java.lang.StringBuilder self, java.lang.Object value)
public static java.io.Writer leftShift(java.net.Socket self, java.lang.Object value)
public static java.io.OutputStream leftShift(java.net.Socket self, byte[] value)
@Deprecated public static java.io.Writer leftShift(java.io.Writer self, java.lang.Object value)
@Deprecated public static java.io.Writer leftShift(java.io.OutputStream self, java.lang.Object value)
@Deprecated public static void leftShift(java.io.ObjectOutputStream self, java.lang.Object value)
@Deprecated public static java.io.OutputStream leftShift(java.io.OutputStream self, java.io.InputStream in)
@Deprecated public static java.io.OutputStream leftShift(java.io.OutputStream self, byte[] value)
public static java.io.File leftShift(java.io.File file, java.lang.Object text)
public static java.io.File leftShift(java.io.File file, byte[] bytes)
public static java.io.File leftShift(java.io.File file, java.io.InputStream data)
@Deprecated public static boolean matches(java.lang.CharSequence self, java.util.regex.Pattern pattern)
@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)
public static java.lang.Object max(java.util.Collection self)
public static java.lang.Object max(java.util.Iterator self)
public static java.lang.Object max(java.lang.Object[] self)
public static java.lang.Object max(java.util.Collection self, Closure closure)
public static java.lang.Object max(java.util.Iterator self, Closure closure)
self
- an Object arrayclosure
- a Closure used to determine the correct ordering
public static java.lang.Object max(java.lang.Object[] self, Closure closure)
assert "hello" == ["hello","hi","hey"].max( { a, b -> a.length() <=> b.length() } as Comparator )
self
- a Collectioncomparator
- a Comparator
public static java.lang.Object max(java.util.Collection self, java.util.Comparator 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)
self
- an Iterator
public static java.lang.Object min(java.util.Iterator self)
public static java.lang.Object min(java.lang.Object[] self)
public static java.lang.Object min(java.util.Collection self, java.util.Comparator 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)
public static java.lang.Object min(java.util.Collection 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)
self
- an Object arrayclosure
- a Closure used to determine the correct ordering
public static java.lang.Object min(java.lang.Object[] self, Closure closure)
assert 5 == [2,3,1,5,4].max()
self
- a Collection
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)
self
- an object arrayremoveMe
- an array of elements to remove
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
if (Number.class.isInstance(t)) { 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)
/** 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)
self
- an Array to flatten
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)
self
- a Numberexponent
- a Number exponent
public static java.lang.Number minus(java.lang.Character left, java.lang.Character right)
@Deprecated public static java.lang.CharSequence minus(java.lang.CharSequence self, java.lang.Object target)
@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)
self
- an Integerexponent
- an Integer exponent
public static java.lang.Number multiply(java.math.BigDecimal left, java.lang.Double right)
public static java.lang.Number multiply(java.math.BigDecimal left, java.math.BigInteger right)
@Deprecated public static java.lang.CharSequence multiply(java.lang.CharSequence self, java.lang.Number factor)
@Deprecated public static java.lang.String multiply(java.lang.String self, java.lang.Number factor)
public static java.io.DataInputStream newDataInputStream(java.io.File file)
@Deprecated public static java.io.DataOutputStream newDataOutputStream(java.io.File file)
@Deprecated public static java.io.BufferedInputStream newInputStream(java.io.File file)
@Deprecated public static java.io.BufferedInputStream newInputStream(java.net.URL url)
@Deprecated public static java.io.BufferedInputStream newInputStream(java.net.URL url, java.util.Map parameters)
} public static java.lang.Object newInstance(java.lang.Class c)
self
- the class whose metaclass we wish to setmetaClass
- the new MetaClass
((ExpandoMetaClass) mc).define(closure); public static java.lang.Object newInstance(java.lang.Class c, java.lang.Object[] args)
self
- the class whose metaclass we wish to updateclosure
- the closure representing the new metaclass
@Deprecated public static java.io.ObjectInputStream newObjectInputStream(java.io.File file)
@Deprecated public static java.io.ObjectInputStream newObjectInputStream(java.io.InputStream inputStream)
@Deprecated public static java.io.ObjectInputStream newObjectInputStream(java.io.InputStream inputStream, java.lang.ClassLoader classLoader)
@Deprecated public static java.io.ObjectInputStream newObjectInputStream(java.io.File file, java.lang.ClassLoader classLoader)
@Deprecated public static java.io.ObjectOutputStream newObjectOutputStream(java.io.File file)
@Deprecated public static java.io.ObjectOutputStream newObjectOutputStream(java.io.OutputStream outputStream)
@Deprecated public static java.io.BufferedOutputStream newOutputStream(java.io.File file)
@Deprecated public static java.io.PrintWriter newPrintWriter(java.io.File file)
@Deprecated public static java.io.PrintWriter newPrintWriter(java.io.File file, java.lang.String charset)
@Deprecated public static java.io.PrintWriter newPrintWriter(java.io.Writer writer)
public static java.io.BufferedReader newReader(java.io.File file)
public static java.io.BufferedReader newReader(java.io.File file, java.lang.String charset)
@Deprecated public static java.io.BufferedReader newReader(java.io.InputStream self)
@Deprecated public static java.io.BufferedReader newReader(java.io.InputStream self, java.lang.String charset)
@Deprecated public static java.io.BufferedReader newReader(java.net.URL url)
} public static java.io.BufferedReader newReader(java.net.URL url, java.util.Map parameters)
public static java.io.BufferedReader newReader(java.net.URL url, java.lang.String charset)
public static java.io.BufferedReader newReader(java.net.URL url, java.util.Map parameters, java.lang.String charset)
@Deprecated public static java.io.BufferedWriter newWriter(java.io.File file)
@Deprecated public static java.io.BufferedWriter newWriter(java.io.File file, boolean append)
@Deprecated public static java.io.BufferedWriter newWriter(java.io.File file, java.lang.String charset, boolean append)
@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)
@Deprecated public static java.lang.CharSequence next(java.lang.CharSequence self)
@Deprecated public static java.lang.String next(java.lang.String self)
@Deprecated public static java.lang.CharSequence normalize(java.lang.CharSequence self)
@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)
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
@Deprecated public static java.lang.CharSequence padLeft(java.lang.CharSequence self, java.lang.Number numberOfChars)
@Deprecated public static java.lang.CharSequence padLeft(java.lang.CharSequence self, java.lang.Number numberOfChars, java.lang.CharSequence padding)
@Deprecated public static java.lang.String padLeft(java.lang.String self, java.lang.Number numberOfChars)
@Deprecated public static java.lang.String padLeft(java.lang.String self, java.lang.Number numberOfChars, java.lang.String padding)
@Deprecated public static java.lang.CharSequence padRight(java.lang.CharSequence self, java.lang.Number numberOfChars)
@Deprecated public static java.lang.CharSequence padRight(java.lang.CharSequence self, java.lang.Number numberOfChars, java.lang.CharSequence padding)
@Deprecated public static java.lang.String padRight(java.lang.String self, java.lang.Number numberOfChars)
@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.Map plus(java.util.Map left, java.util.Map right)
self
- a Mapkey
- an Object as a key for the mapvalue
- the value to put into the map
public static java.util.Map plus(java.util.Map self, java.util.Collection entries)
* @param right a Collection to be appended public static java.lang.Object[] plus(java.lang.Object[] left, java.lang.Object[] right)
* assert result.class.array public static java.lang.Object[] plus(java.lang.Object[] left, java.lang.Object right)
*assert [1,2,3,4] == [1,2] + [3,4]public static java.lang.Object[] plus(java.lang.Object[] left, java.util.Collection right)
* @since 1.8.7 public static java.lang.Object[] plus(java.lang.Object[] left, java.lang.Iterable right)
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)
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)
@Deprecated public static java.lang.CharSequence plus(java.lang.CharSequence left, java.lang.Object value)
@Deprecated public static java.lang.String plus(java.lang.Number value, java.lang.String right)
@Deprecated public static java.lang.String plus(java.lang.String left, java.lang.Object value)
@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)
left
- a Numberright
- a Character
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)
@Deprecated public static java.lang.CharSequence previous(java.lang.CharSequence self)
@Deprecated public static java.lang.String previous(java.lang.String self)
protected static java.lang.Object primitiveArrayGet(java.lang.Object self, int idx)
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)
def list = ["a", true] list[1..<1] = 5 assert list == ["a", 5, true]
self
- a Listrange
- the (in this case empty) subset of the list to setvalue
- the values to put at the given sublist or a Collection of values
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)
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
@Deprecated public static void putAt(java.lang.StringBuffer self, EmptyRange range, java.lang.Object value)
@Deprecated public static void putAt(java.lang.StringBuffer self, IntRange range, java.lang.Object value)
public static byte[] readBytes(java.io.File file)
@Deprecated public static java.lang.String readLine(java.io.Reader self)
@Deprecated public static java.util.List readLines(java.lang.CharSequence self)
@Deprecated public static java.util.List readLines(java.lang.String self)
@Deprecated public static java.util.List readLines(java.io.File file)
@Deprecated public static java.util.List readLines(java.io.File file, java.lang.String charset)
@Deprecated public static java.util.List readLines(java.io.InputStream stream)
@Deprecated public static java.util.List readLines(java.io.InputStream stream, java.lang.String charset)
@Deprecated public static java.util.List readLines(java.net.URL self)
@Deprecated public static java.util.List readLines(java.net.URL self, java.lang.String charset)
@Deprecated public static java.util.List readLines(java.io.Reader reader)
public static boolean removeAll(java.util.Collection self, java.lang.Object[] items)
grep
and findAll
when wanting to produce a new list
containing items which match some specified items but leaving the original collection unchanged.
self
- a Collection to be modifieditems
- array containing elements to be retained from this collection
public static boolean removeAll(java.util.Collection self, Closure condition)
public static boolean renameTo(java.io.File self, java.lang.String newPathName)
@Deprecated public static java.lang.CharSequence replaceAll(java.lang.CharSequence self, java.lang.CharSequence regex, java.lang.CharSequence replacement)
@Deprecated public static java.lang.CharSequence replaceAll(java.lang.CharSequence self, java.lang.CharSequence regex, Closure closure)
@Deprecated public static java.lang.CharSequence replaceAll(java.lang.CharSequence self, java.util.regex.Pattern pattern, java.lang.CharSequence replacement)
@Deprecated public static java.lang.String replaceAll(java.lang.CharSequence self, java.util.regex.Pattern pattern, Closure closure)
@Deprecated public static java.lang.String replaceAll(java.lang.String self, java.util.regex.Pattern pattern, Closure closure)
@Deprecated public static java.lang.String replaceAll(java.lang.String self, java.util.regex.Pattern pattern, java.lang.String replacement)
@Deprecated public static java.lang.String replaceAll(java.lang.String self, java.lang.String regex, Closure closure)
@Deprecated public static java.lang.String replaceFirst(java.lang.CharSequence self, java.lang.CharSequence regex, java.lang.CharSequence replacement)
@Deprecated public static java.lang.String replaceFirst(java.lang.CharSequence self, java.lang.CharSequence regex, Closure closure)
@Deprecated public static java.lang.CharSequence replaceFirst(java.lang.CharSequence self, java.util.regex.Pattern pattern, java.lang.CharSequence replacement)
@Deprecated public static java.lang.String replaceFirst(java.lang.CharSequence self, java.util.regex.Pattern pattern, Closure closure)
@Deprecated public static java.lang.String replaceFirst(java.lang.String self, java.util.regex.Pattern pattern, Closure closure)
@Deprecated public static java.lang.String replaceFirst(java.lang.String self, java.util.regex.Pattern pattern, java.lang.String replacement)
@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)
findAll
and grep
when wanting to produce a new list
containing items which match some criteria but leaving the original collection unchanged.
self
- a Collection to be modifiedcondition
- a closure condition
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)
self
- an array
* @since 1.5.5 public static java.lang.Object[] reverse(java.lang.Object[] self)
* @param left the left Array public static java.lang.Object[] reverse(java.lang.Object[] self, boolean mutate)
public static java.util.Iterator reverse(java.util.Iterator self)
@Deprecated public static java.lang.CharSequence reverse(java.lang.CharSequence self)
@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)
self
- a Character to convert
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
public static void setBytes(java.io.File file, byte[] bytes)
public static void setBytes(java.io.OutputStream os, byte[] bytes)
@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)
public static void setText(java.io.File file, java.lang.String text)
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)
array
- a short array
public static int size(short[] array)
array
- an int array
public static int size(int[] array)
public static int size(long[] array)
public static int size(float[] array)
public static int size(double[] array)
@Deprecated public static int size(java.lang.CharSequence text)
@Deprecated public static long size(java.util.regex.Matcher self)
@Deprecated public static int size(java.lang.String text)
@Deprecated public static int size(java.lang.StringBuffer buffer)
@Deprecated public static long size(java.io.File self)
public static java.util.List sort(java.util.Collection self)
public static java.util.List sort(java.util.Collection self, boolean mutate)
def map = [a:5, b:3, c:6, d:4].sort { a, b -> a.value <=> b.value } assert map == [b:3, d:4, a:5, c:6]
self
- the original unsorted mapclosure
- a Closure used as a comparator
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)
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 sorted
public static java.util.Iterator sort(java.util.Iterator self)
public static java.util.Iterator sort(java.util.Iterator self, java.util.Comparator comparator)
public static java.util.List sort(java.util.Collection self, java.util.Comparator comparator)
public static java.util.List sort(java.util.Collection self, boolean mutate, java.util.Comparator comparator)
self
- the array to be sortedcomparator
- a Comparator used for the comparison
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)
self
- the Iterator to be sortedclosure
- a Closure used to determine the correct ordering
public static java.util.Iterator sort(java.util.Iterator self, Closure closure)
*/ public static java.lang.Object[] sort(java.lang.Object[] self, Closure closure)
* @since 1.0 public static java.lang.Object[] sort(java.lang.Object[] self, boolean mutate, Closure closure)
public static java.util.List sort(java.util.Collection self, Closure closure)
public static java.util.List sort(java.util.Collection 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)
public static java.util.Collection split(java.lang.Object self, Closure closure)
public static java.util.Collection split(java.util.Collection self, Closure closure)
@Deprecated public static java.lang.CharSequence[] split(java.lang.CharSequence self)
@Deprecated public static java.lang.String[] split(GString self)
@Deprecated public static java.lang.String[] split(java.lang.String self)
@Deprecated public static java.lang.Object splitEachLine(java.lang.CharSequence self, java.lang.CharSequence regex, Closure closure)
@Deprecated public static java.lang.Object splitEachLine(java.lang.CharSequence self, java.util.regex.Pattern pattern, Closure closure)
@Deprecated public static java.lang.Object splitEachLine(java.lang.String self, java.util.regex.Pattern pattern, Closure closure)
public static java.lang.Object splitEachLine(java.lang.String self, java.lang.String regex, Closure closure)
@Deprecated public static java.lang.Object splitEachLine(java.io.File self, java.lang.String regex, Closure closure)
@Deprecated public static java.lang.Object splitEachLine(java.io.File self, java.util.regex.Pattern pattern, Closure closure)
@Deprecated public static java.lang.Object splitEachLine(java.io.File self, java.lang.String regex, java.lang.String charset, Closure closure)
@Deprecated public static java.lang.Object splitEachLine(java.io.File self, java.util.regex.Pattern pattern, java.lang.String charset, Closure closure)
@Deprecated public static java.lang.Object splitEachLine(java.net.URL self, java.lang.String regex, Closure closure)
@Deprecated public static java.lang.Object splitEachLine(java.net.URL self, java.util.regex.Pattern pattern, Closure closure)
@Deprecated public static java.lang.Object splitEachLine(java.net.URL self, java.lang.String regex, java.lang.String charset, Closure closure)
@Deprecated public static java.lang.Object splitEachLine(java.net.URL self, java.util.regex.Pattern pattern, java.lang.String charset, Closure closure)
@Deprecated public static java.lang.Object splitEachLine(java.io.Reader self, java.lang.String regex, Closure closure)
@Deprecated public static java.lang.Object splitEachLine(java.io.Reader self, java.util.regex.Pattern pattern, Closure closure)
@Deprecated public static java.lang.Object splitEachLine(java.io.InputStream stream, java.lang.String regex, java.lang.String charset, Closure closure)
@Deprecated public static java.lang.Object splitEachLine(java.io.InputStream stream, java.util.regex.Pattern pattern, java.lang.String charset, Closure closure)
@Deprecated public static java.lang.Object splitEachLine(java.io.InputStream stream, java.lang.String regex, Closure closure)
@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
public static java.lang.CharSequence stripIndent(java.lang.CharSequence self)
} public static java.lang.CharSequence stripIndent(java.lang.CharSequence self, int numChars)
} public static java.lang.String stripIndent(java.lang.String self)
} public static java.lang.String stripIndent(java.lang.String self, int numChars)
} public static java.lang.CharSequence stripMargin(java.lang.CharSequence self)
} public static java.lang.CharSequence stripMargin(java.lang.CharSequence self, char marginChar)
} public static java.lang.String stripMargin(java.lang.CharSequence self, java.lang.CharSequence marginChar)
} public static java.lang.String stripMargin(java.lang.String self)
} public static java.lang.String stripMargin(java.lang.String self, char marginChar)
} 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 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
public static java.lang.Object sum(java.util.Collection self)
self
- The array of values to add together
public static java.lang.Object sum(java.lang.Object[] self)
public static java.lang.Object sum(java.util.Iterator self)
public static java.lang.Object sum(java.util.Collection 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)
public static java.lang.Object sum(java.util.Collection self, Closure closure)
array.sum(closure)
is equivalent to:
array.collect(closure).sum()
.
self
- An arrayclosure
- a single parameter closure that returns a numeric value.
public static java.lang.Object sum(java.lang.Object[] self, Closure closure)
public static java.lang.Object sum(java.util.Iterator self, Closure closure)
public static java.lang.Object sum(java.util.Collection 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)
num
elements from the head of this list.
def strings = [ 'a', 'b', 'c' ] assert strings.take( 0 ) == [] assert strings.take( 2 ) == [ 'a', 'b' ] assert strings.take( 5 ) == [ 'a', 'b', 'c' ]Similar to take(Iterable, int) except that it attempts to preserve the type of the original list.
self
- the original listnum
- the number of elements to take from this listnum
elements of this list,
or else the whole list if it has less then num
elements.
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)
public static CharSequence take(CharSequence self, int num) { public static java.util.Iterator take(java.util.Iterator self, int num)
ret.addAll(self); public static java.lang.CharSequence take(java.lang.CharSequence self, int num)
public static java.util.List takeWhile(java.util.List self, Closure condition)
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
} public static java.math.BigDecimal toBigDecimal(java.lang.CharSequence self)
} 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
} public static java.math.BigInteger toBigInteger(java.lang.CharSequence self)
} public static java.math.BigInteger toBigInteger(java.lang.String self)
public static java.lang.Boolean toBoolean(java.lang.Boolean self)
} public static java.lang.Boolean toBoolean(java.lang.String self)
} public static java.lang.Character toCharacter(java.lang.String self)
public static java.lang.Double toDouble(java.lang.Number self)
left
- left operatorright
- right operator
} public static java.lang.Double toDouble(java.lang.CharSequence self)
} public static java.lang.Double toDouble(java.lang.String self)
public static java.lang.Float toFloat(java.lang.Number self)
left
- left operatorright
- right operator
} public static java.lang.Float toFloat(java.lang.CharSequence self)
} public static java.lang.Float toFloat(java.lang.String self)
public static java.lang.Integer toInteger(java.lang.Number self)
} public static java.lang.Integer toInteger(java.lang.CharSequence self)
} 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)
public static java.util.List toList(byte[] array)
array
- a byte array
public static java.util.List toList(boolean[] array)
array
- a boolean array
public static java.util.List toList(char[] array)
array
- a char array
public static java.util.List toList(short[] array)
array
- a short array
public static java.util.List toList(int[] array)
array
- an int array
public static java.util.List toList(long[] array)
array
- a long array
public static java.util.List toList(float[] array)
array
- a float array
public static java.util.List toList(double[] array)
array
- a double array
@Deprecated public static java.util.List toList(java.lang.CharSequence self)
@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)
@Deprecated public static java.lang.Long toLong(java.lang.CharSequence self)
@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)
self
- a Character
public static java.lang.String toMapString(java.util.Map self, int maxSize)
* @return a Set public static java.util.Set toSet(byte[] array)
* @param self an iterator public static java.util.Set toSet(boolean[] array)
* Convert an enumeration to a Set. public static java.util.Set toSet(char[] array)
public static java.util.Set toSet(short[] array)
/** public static java.util.Set toSet(int[] array)
self
- an array objectidx
- the index of interest
} public static java.util.Set toSet(long[] array)
self
- an array objectrange
- the range of indices of interest
*/ public static java.util.Set toSet(float[] array)
return answer; 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)
public static java.util.Set toSet(java.util.Enumeration self)
@Deprecated public static java.util.Set toSet(java.lang.CharSequence self)
@Deprecated public static java.util.Set toSet(java.lang.String self)
@Deprecated public static java.lang.Short toShort(java.lang.CharSequence self)
@Deprecated 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)
[1, 2, a]
.
self
- a Collection
public static java.lang.String toString(int[] self)
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)
public static java.lang.String toString(java.lang.Object[] self)
public static java.lang.String toString(java.lang.Object value)
public static java.net.URI toURI(java.lang.CharSequence self)
public static java.net.URI toURI(java.lang.String self)
public static java.net.URL toURL(java.lang.CharSequence self)
public static java.net.URL toURL(java.lang.String self)
public static char toUpperCase(java.lang.Character self)
} public static java.util.List tokenize(java.lang.CharSequence self)
} public static java.util.List tokenize(java.lang.CharSequence self, java.lang.Character token)
} public static java.util.List tokenize(java.lang.CharSequence self, java.lang.CharSequence token)
} public static java.util.List tokenize(java.lang.String self)
public static java.util.List tokenize(java.lang.String self, java.lang.Character token)
@Deprecated public static java.util.List tokenize(java.lang.String self, java.lang.String token)
public static java.lang.CharSequence tr(java.lang.CharSequence self, java.lang.CharSequence sourceSet, java.lang.CharSequence replacementSet)
public static java.lang.String tr(java.lang.String self, java.lang.String sourceSet, java.lang.String replacementSet)
public static void transformChar(java.io.Reader self, java.io.Writer writer, Closure closure)
public static void transformLine(java.io.Reader reader, java.io.Writer writer, Closure closure)
public static java.util.List transpose(java.util.List self)
@Deprecated public static void traverse(java.io.File self, java.util.Map options, Closure closure)
public staticT withDataOutputStream(File file, Closure closure) throws IOException { public static void traverse(java.io.File self, Closure closure)
public staticT withDataInputStream(File file, Closure closure) throws IOException { 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)
public static java.lang.Number unaryMinus(java.lang.Number left)
public static java.lang.CharSequence unexpand(java.lang.CharSequence self)
public static java.lang.CharSequence unexpand(java.lang.CharSequence self, int tabStop)
public static java.lang.String unexpand(java.lang.String self)
public static java.lang.String unexpand(java.lang.String self, int tabStop)
public static java.lang.CharSequence unexpandLine(java.lang.CharSequence self, int tabStop)
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)
0.1.upto( 10 ) { println it }Prints numbers 0.1, 1.1, 2.1... to 9.1
self
- a BigDecimalto
- the end numberclosure
- the code to execute for each number
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)
@Deprecated public static java.lang.Object withDataInputStream(java.io.File file, Closure closure)
@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)
assert [1,2,3] == [3,1,2].sort()
self
- the collection to be sorted
@Deprecated public static java.lang.Object withInputStream(java.io.File file, Closure closure)
@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)
@Deprecated public static java.lang.Object withObjectInputStream(java.io.File file, Closure closure)
@Deprecated public static java.lang.Object withObjectInputStream(java.io.File file, java.lang.ClassLoader classLoader, Closure closure)
@Deprecated public static java.lang.Object withObjectInputStream(java.io.InputStream inputStream, Closure closure)
@Deprecated public static java.lang.Object withObjectInputStream(java.io.InputStream inputStream, java.lang.ClassLoader classLoader, Closure closure)
@Deprecated public static java.lang.Object withObjectOutputStream(java.io.File file, Closure closure)
@Deprecated public static java.lang.Object withObjectOutputStream(java.io.OutputStream outputStream, Closure closure)
public static java.lang.Object withObjectStreams(java.net.Socket socket, Closure closure)
@Deprecated public static java.lang.Object withOutputStream(java.io.File file, Closure closure)
@Deprecated public static java.lang.Object withPrintWriter(java.io.File file, Closure closure)
@Deprecated public static java.lang.Object withPrintWriter(java.io.File file, java.lang.String charset, Closure closure)
@Deprecated public static java.lang.Object withPrintWriter(java.io.Writer writer, Closure closure)
@Deprecated public static java.lang.Object withReader(java.io.File file, Closure closure)
@Deprecated public static java.lang.Object withReader(java.io.File file, java.lang.String charset, Closure closure)
@Deprecated public static java.lang.Object withReader(java.io.Reader reader, Closure closure)
@Deprecated public static java.lang.Object withReader(java.net.URL url, Closure closure)
@Deprecated public static java.lang.Object withReader(java.net.URL url, java.lang.String charset, Closure closure)
@Deprecated public static java.lang.Object withReader(java.io.InputStream in, Closure closure)
@Deprecated public static java.lang.Object withReader(java.io.InputStream in, java.lang.String charset, Closure closure)
@Deprecated public static java.lang.Object withStream(java.io.InputStream stream, Closure closure)
@Deprecated public static java.lang.Object withStream(java.io.OutputStream os, Closure closure)
public static java.lang.Object withStreams(java.net.Socket socket, Closure closure)
@Deprecated public static java.lang.Object withWriter(java.io.File file, Closure closure)
@Deprecated public static java.lang.Object withWriter(java.io.File file, java.lang.String charset, Closure closure)
@Deprecated public static java.lang.Object withWriter(java.io.Writer writer, Closure closure)
@Deprecated public static java.lang.Object withWriter(java.io.OutputStream stream, Closure closure)
@Deprecated public static java.lang.Object withWriter(java.io.OutputStream stream, java.lang.String charset, Closure closure)
@Deprecated public static java.lang.Object withWriterAppend(java.io.File file, java.lang.String charset, Closure closure)
@Deprecated public static java.lang.Object withWriterAppend(java.io.File file, Closure closure)
@Deprecated public static void write(java.io.Writer self, Writable writable)
public static void write(java.io.File file, java.lang.String text)
public static void write(java.io.File file, java.lang.String text, java.lang.String charset)
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