public class DefaultGroovyMethods extends DefaultGroovyMethodsSupport
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.
DefaultGroovyMethodsSupport.RangeInfo| Modifier and Type | Field and Description |
|---|---|
static Class[] |
additionals |
| Constructor and Description |
|---|
DefaultGroovyMethods() |
| Modifier and Type | Method and Description |
|---|---|
static double |
abs(Double number)
Get the absolute value
|
static float |
abs(Float number)
Get the absolute value
|
static long |
abs(Long number)
Get the absolute value
|
static int |
abs(Number number)
Get the absolute value
|
static Socket |
accept(ServerSocket serverSocket,
boolean runInANewThread,
Closure closure)
Accepts a connection and passes the resulting Socket to the closure
which runs in a new Thread or the calling thread, as needed.
|
static Socket |
accept(ServerSocket serverSocket,
Closure closure)
Accepts a connection and passes the resulting Socket to the closure
which runs in a new Thread.
|
static <T> boolean |
addAll(Collection<T> self,
T[] items)
Modifies the collection by adding all of the elements in the specified array to the collection.
|
static <T> boolean |
addAll(List<T> self,
int index,
T[] items)
Modifies this list by inserting all of the elements in the specified array into the
list at the specified position.
|
static void |
addShutdownHook(Object self,
Closure closure)
Allows the usage of addShutdownHook without getting the runtime first.
|
static BitSet |
and(BitSet left,
BitSet right)
Bitwise AND together two BitSets.
|
static Boolean |
and(Boolean left,
Boolean right)
Logical conjunction of two boolean operators.
|
static Number |
and(Number left,
Number right)
Bitwise AND together two Numbers.
|
static <K,V> boolean |
any(Map<K,V> self,
Closure<?> closure)
Iterates over the entries of a map, and checks whether a predicate is
valid for at least one entry.
|
static boolean |
any(Object self)
Iterates over the elements of a collection, and checks whether at least
one element is true according to the Groovy Truth.
|
static boolean |
any(Object self,
Closure closure)
Iterates over the contents of an object or collection, and checks whether a
predicate is valid for at least one element.
|
static void |
append(File file,
byte[] bytes)
Append bytes to the end of a File.
|
static void |
append(File self,
InputStream stream)
Append binary data to the file.
|
static void |
append(File file,
Object text)
Append the text at the end of the File.
|
static void |
append(File file,
Object text,
String charset)
Append the text at the end of the File, using a specified encoding.
|
static boolean |
asBoolean(Boolean bool)
Coerce an Boolean instance to a boolean value.
|
static boolean |
asBoolean(boolean[] array)
Coerces a boolean array to a boolean value.
|
static boolean |
asBoolean(byte[] array)
Coerces a byte array to a boolean value.
|
static boolean |
asBoolean(char[] array)
Coerces a char array to a boolean value.
|
static boolean |
asBoolean(Character character)
Coerce a character to a boolean value.
|
static boolean |
asBoolean(CharSequence string)
Coerce a string (an instance of CharSequence) to a boolean value.
|
static boolean |
asBoolean(Collection collection)
Coerce a collection instance to a boolean value.
|
static boolean |
asBoolean(double[] array)
Coerces a double array to a boolean value.
|
static boolean |
asBoolean(Enumeration enumeration)
Coerce an enumeration instance to a boolean value.
|
static boolean |
asBoolean(float[] array)
Coerces a float array to a boolean value.
|
static boolean |
asBoolean(int[] array)
Coerces an int array to a boolean value.
|
static boolean |
asBoolean(Iterator iterator)
Coerce an iterator instance to a boolean value.
|
static boolean |
asBoolean(long[] array)
Coerces a long array to a boolean value.
|
static boolean |
asBoolean(Map map)
Coerce a map instance to a boolean value.
|
static boolean |
asBoolean(Matcher matcher)
Coerce a Matcher instance to a boolean value.
|
static boolean |
asBoolean(Number number)
Coerce a number to a boolean value.
|
static boolean |
asBoolean(Object object)
Coerce an object instance to a boolean value.
|
static boolean |
asBoolean(Object[] array)
Coerce an Object array to a boolean value.
|
static boolean |
asBoolean(short[] array)
Coerces a short array to a boolean value.
|
static <T> Collection<T> |
asImmutable(Collection<? extends T> self)
A convenience method for creating an immutable Collection.
|
static <T> List<T> |
asImmutable(List<? extends T> self)
A convenience method for creating an immutable list
|
static <K,V> Map<K,V> |
asImmutable(Map<? extends K,? extends V> self)
A convenience method for creating an immutable map.
|
static <T> Set<T> |
asImmutable(Set<? extends T> self)
A convenience method for creating an immutable list.
|
static <K,V> SortedMap<K,V> |
asImmutable(SortedMap<K,? extends V> self)
A convenience method for creating an immutable sorted map.
|
static <T> SortedSet<T> |
asImmutable(SortedSet<T> self)
A convenience method for creating an immutable sorted set.
|
static <T> List<T> |
asList(Collection<T> self)
Converts this Collection to a List.
|
static <T> Collection<T> |
asSynchronized(Collection<T> self)
A convenience method for creating a synchronized Collection.
|
static <T> List<T> |
asSynchronized(List<T> self)
A convenience method for creating a synchronized List.
|
static <K,V> Map<K,V> |
asSynchronized(Map<K,V> self)
A convenience method for creating a synchronized Map.
|
static <T> Set<T> |
asSynchronized(Set<T> self)
A convenience method for creating a synchronized Set.
|
static <K,V> SortedMap<K,V> |
asSynchronized(SortedMap<K,V> self)
A convenience method for creating a synchronized SortedMap.
|
static <T> SortedSet<T> |
asSynchronized(SortedSet<T> self)
A convenience method for creating a synchronized SortedSet.
|
static <T> T |
asType(CharSequence self,
Class<T> c)
Provides a method to perform custom 'dynamic' type conversion
to the given class using the
as operator. |
static <T> T |
asType(Closure cl,
Class<T> clazz)
Coerces the closure to an implementation of the given class.
|
static <T> T |
asType(Collection col,
Class<T> clazz)
Converts the given collection to another type.
|
static <T> T |
asType(File f,
Class<T> c)
Converts this File to a
Writable or delegates to default
asType(java.lang.Object, java.lang.Class). |
static <T> T |
asType(GString self,
Class<T> c)
Converts the GString to a File, or delegates to the default
asType(java.lang.Object, java.lang.Class) |
static <T> T |
asType(Map map,
Class<T> clazz)
Coerces this map to the given type, using the map's keys as the public
method names, and values as the implementation.
|
static <T> T |
asType(Number self,
Class<T> c)
Transform this number to a the given type, using the 'as' operator.
|
static <T> T |
asType(Object[] ary,
Class<T> clazz)
Converts the given array to either a List, Set, or
SortedSet.
|
static <T> T |
asType(Object obj,
Class<T> type)
Converts a given object to a type.
|
static <T> T |
asType(String self,
Class<T> c)
Provides a method to perform custom 'dynamic' type conversion
to the given class using the
as operator. |
static File |
asWritable(File file)
Converts this File to a
Writable. |
static File |
asWritable(File file,
String encoding)
Allows a file to return a Writable implementation that can output itself
to a Writer stream.
|
static BitSet |
bitwiseNegate(BitSet self)
Bitwise NEGATE a BitSet.
|
static Pattern |
bitwiseNegate(CharSequence self)
Turns a CharSequence into a regular expression Pattern
|
static Pattern |
bitwiseNegate(String self)
Turns a String into a regular expression Pattern
|
protected static <T> T |
callClosureForLine(Closure<T> closure,
String line,
int counter) |
protected static <T> T |
callClosureForMapEntry(Closure<T> closure,
Map.Entry entry) |
protected static <T> T |
callClosureForMapEntryAndCounter(Closure<T> closure,
Map.Entry entry,
int counter) |
static CharSequence |
capitalize(CharSequence self)
Convenience method to capitalize the first letter of a CharSequence.
|
static String |
capitalize(String self)
Convenience method to capitalize the first letter of a string
(typically the first letter of a word).
|
static CharSequence |
center(CharSequence self,
Number numberOfChars)
Pad a CharSequence to a minimum length specified by numberOfChars by adding the space character around it as many times as needed so that it remains centered.
|
static CharSequence |
center(CharSequence self,
Number numberOfChars,
CharSequence padding)
Pad a CharSequence to a minimum length specified by numberOfChars, appending the supplied padding CharSequence around the original as many times as needed keeping it centered.
|
static String |
center(String self,
Number numberOfChars)
Pad a String to a minimum length specified by numberOfChars by adding the space character around it as many times as needed so that it remains centered.
|
static String |
center(String self,
Number numberOfChars,
String padding)
Pad a String to a minimum length specified by numberOfChars, appending the supplied padding String around the original as many times as needed keeping it centered.
|
static <T> List<T> |
collect(Collection<?> self,
Closure<T> closure)
Iterates through this collection transforming each entry into a new value using the closure
as a transformer, returning a list of transformed values.
|
static <T> Collection<T> |
collect(Collection<?> self,
Collection<T> collection,
Closure<? extends T> closure)
Iterates through this collection transforming each value into a new value using the closure
as a transformer, returning an initial collection plus the transformed values.
|
static <T> Collection<T> |
collect(Map<?,?> self,
Collection<T> collection,
Closure<? extends T> closure)
Iterates through this Map transforming each entry into a new value using the closure
as a transformer, returning a list of transformed values.
|
static <T> List<T> |
collect(Map self,
Closure<T> closure)
Iterates through this Map transforming each entry into a new value using the closure
as a transformer, returning a list of transformed values.
|
static <T> List<T> |
collect(Object self,
Closure<T> closure)
Iterates through this object transforming each value into a new value using the
closure as a transformer, returning a list of transformed values.
|
static <T> Collection<T> |
collect(Object self,
Collection<T> collection,
Closure<? extends T> closure)
Iterates through this object transforming each object into a new value using the closure
as a transformer and adding it to the collection, returning the resulting collection.
|
static List |
collectAll(Collection self,
Closure closure)
Deprecated.
Use collectNested instead
|
static Collection |
collectAll(Collection self,
Collection collection,
Closure closure)
Deprecated.
Use collectNested instead
|
static <K,V> Map<K,V> |
collectEntries(Collection<?> self,
Closure<?> closure)
Iterates through this Collection transforming each item using the closure
as a transformer into a map entry, returning a map of the transformed entries.
|
static <K,V> Map<K,V> |
collectEntries(Collection<?> self,
Map<K,V> result,
Closure<?> closure)
Iterates through this Collection transforming each item using the closure
as a transformer into a map entry, returning a map of the transformed entries.
|
static Map<?,?> |
collectEntries(Map<?,?> self,
Closure<?> closure)
Iterates through this Map transforming each entry using the closure
as a transformer, returning a map of the transformed entries.
|
static <K,V> Map<K,V> |
collectEntries(Map<?,?> self,
Map<K,V> result,
Closure<?> closure)
Iterates through this Map transforming each entry using the closure
as a transformer, returning a map of the transformed entries.
|
static <K,V> Map<K,V> |
collectEntries(Object[] self,
Closure<?> closure)
Iterates through this array transforming each item using the closure
as a transformer into a map entry, returning a map of the transformed entries.
|
static <K,V> Map<K,V> |
collectEntries(Object[] self,
Map<K,V> result,
Closure<?> closure)
Iterates through this array transforming each item using the closure
as a transformer into a map entry, returning a map of the transformed entries.
|
static <T> Collection<T> |
collectMany(Collection self,
Closure<Collection<T>> closure)
Projects each item from a source collection to a collection and concatenates (flattens) the resulting collections into a single one.
|
static <T> Collection<T> |
collectMany(Iterator<Object> self,
Closure<Collection<T>> closure)
Projects each item from a source iterator to a collection and concatenates (flattens) the resulting collections into a single one.
|
static <T> Collection<T> |
collectMany(Object[] self,
Closure<Collection<T>> closure)
Projects each item from a source array to a collection and concatenates (flattens) the resulting collections into a single one.
|
static List |
collectNested(Collection self,
Closure closure)
Recursively iterates through this collection transforming each non-Collection value
into a new value using the closure as a transformer.
|
static Collection |
collectNested(Collection self,
Collection collection,
Closure closure)
Recursively iterates through this collection transforming each non-Collection value
into a new value using the closure as a transformer.
|
static List |
combinations(Collection self)
Adds GroovyCollections#combinations(Collection) as a method on collections.
|
static int |
compareTo(Character left,
Character right)
Compare two Characters.
|
static int |
compareTo(Character left,
Number right)
Compare a Character and a Number.
|
static int |
compareTo(Number left,
Character right)
Compare a Number and a Character.
|
static int |
compareTo(Number left,
Number right)
Compare two Numbers.
|
static boolean |
contains(CharSequence self,
CharSequence text)
Provide an implementation of contains() like
Collection.contains(java.lang.Object) to make CharSequences more polymorphic. |
static boolean |
contains(String self,
String text)
Provide an implementation of contains() like
Collection.contains(java.lang.Object) to make Strings more polymorphic. |
static boolean |
containsAll(Collection self,
Object[] items)
Returns true if this collection contains all of the elements
in the specified array.
|
static Number |
count(boolean[] self,
Object value)
Counts the number of occurrences of the given value inside this array.
|
static Number |
count(byte[] self,
Object value)
Counts the number of occurrences of the given value inside this array.
|
static Number |
count(char[] self,
Object value)
Counts the number of occurrences of the given value inside this array.
|
static int |
count(CharSequence self,
CharSequence text)
Count the number of occurrences of a sub CharSequence.
|
static Number |
count(Collection self,
Closure closure)
Counts the number of occurrences which satisfy the given closure from inside this collection.
|
static Number |
count(Collection self,
Object value)
Counts the number of occurrences of the given value inside this collection.
|
static Number |
count(double[] self,
Object value)
Counts the number of occurrences of the given value inside this array.
|
static Number |
count(float[] self,
Object value)
Counts the number of occurrences of the given value inside this array.
|
static Number |
count(int[] self,
Object value)
Counts the number of occurrences of the given value inside this array.
|
static Number |
count(Iterator self,
Closure closure)
Counts the number of occurrences which satisfy the given closure from the
items within this Iterator.
|
static Number |
count(Iterator self,
Object value)
Counts the number of occurrences of the given value from the
items within this Iterator.
|
static Number |
count(long[] self,
Object value)
Counts the number of occurrences of the given value inside this array.
|
static Number |
count(Map self,
Closure<?> closure)
Counts the number of occurrences which satisfy the given closure from inside this map.
|
static Number |
count(Object[] self,
Closure closure)
Counts the number of occurrences which satisfy the given closure from inside this array.
|
static Number |
count(Object[] self,
Object value)
Counts the number of occurrences of the given value inside this array.
|
static Number |
count(short[] self,
Object value)
Counts the number of occurrences of the given value inside this array.
|
static int |
count(String self,
String text)
Count the number of occurrences of a substring.
|
static <K> Map<K,Integer> |
countBy(Collection self,
Closure<K> closure)
Sorts all collection members into groups determined by the supplied mapping
closure and counts the group size.
|
static <K> Map<K,Integer> |
countBy(Iterator self,
Closure<K> closure)
Sorts all iterator items into groups determined by the supplied mapping
closure and counts the group size.
|
static <K> Map<K,Integer> |
countBy(Map self,
Closure<K> closure)
Groups the members of a map into groups determined by the
supplied mapping closure and counts the frequency of the created groups.
|
static <K> Map<K,Integer> |
countBy(Object[] self,
Closure<K> closure)
Sorts all array members into groups determined by the supplied mapping
closure and counts the group size.
|
protected static StringBufferWriter |
createStringBufferWriter(StringBuffer self) |
protected static StringWriter |
createStringWriter(String self) |
static boolean |
deleteDir(File self)
Deletes a directory with all contained files and subdirectories.
|
static CharSequence |
denormalize(CharSequence self)
Return a CharSequence with lines (separated by LF, CR/LF, or CR)
terminated by the platform specific line separator.
|
static String |
denormalize(String self)
Return a String with lines (separated by LF, CR/LF, or CR)
terminated by the platform specific line separator.
|
static boolean |
disjoint(Collection left,
Collection right)
Returns
true if the intersection of two collections is empty. |
static Number |
div(Character left,
Character right)
Divide one Character by another.
|
static Number |
div(Character left,
Number right)
Divide a Character by a Number.
|
static Number |
div(Number left,
Character right)
Divide a Number by a Character.
|
static void |
downto(BigDecimal self,
Number to,
Closure closure)
Iterates from this number down to the given number, inclusive,
decrementing by one each time.
|
static void |
downto(BigInteger self,
Number to,
Closure closure)
Iterates from this number down to the given number, inclusive,
decrementing by one each time.
|
static void |
downto(double self,
Number to,
Closure closure)
Iterates from this number down to the given number, inclusive,
decrementing by one each time.
|
static void |
downto(Double self,
Number to,
Closure closure)
Iterates from this number down to the given number, inclusive,
decrementing by one each time.
|
static void |
downto(float self,
Number to,
Closure closure)
Iterates from this number down to the given number, inclusive,
decrementing by one each time.
|
static void |
downto(Float self,
Number to,
Closure closure)
Iterates from this number down to the given number, inclusive,
decrementing by one each time.
|
static void |
downto(long self,
Number to,
Closure closure)
Iterates from this number down to the given number, inclusive,
decrementing by one each time.
|
static void |
downto(Long self,
Number to,
Closure closure)
Iterates from this number down to the given number, inclusive,
decrementing by one each time.
|
static void |
downto(Number self,
Number to,
Closure closure)
Iterates from this number down to the given number, inclusive,
decrementing by one each time.
|
static CharSequence |
drop(CharSequence self,
int num)
Drops the given number of chars from the head of this CharSequence
if they are available.
|
static <T> Iterator<T> |
drop(Iterator<T> self,
int num)
Drops the given number of elements from the head of this iterator if they are available.
|
static <T> List<T> |
drop(List<T> self,
int num)
Drops the given number of elements from the head of this list
if they are available.
|
static <K,V> Map<K,V> |
drop(Map<K,V> self,
int num)
Drops the given number of key/value pairs from the head of this map if they are available.
|
static <T> T[] |
drop(T[] self,
int num)
Drops the given number of elements from the head of this array
if they are available.
|
static String |
dump(Object self)
Generates a detailed dump string of an object showing its class,
hashCode and fields.
|
static <K,V> Map<K,V> |
each(Map<K,V> self,
Closure closure)
Allows a Map to be iterated through using a closure.
|
static <T> T |
each(T self,
Closure closure)
Iterates through an aggregate type or data structure,
passing each item to the given closure.
|
static void |
eachByte(byte[] self,
Closure closure)
Traverse through each byte of this byte array.
|
static void |
eachByte(Byte[] self,
Closure closure)
Traverse through each byte of this Byte array.
|
static void |
eachByte(File self,
Closure closure)
Traverse through each byte of this File
|
static void |
eachByte(File self,
int bufferLen,
Closure closure)
Traverse through the bytes of this File, bufferLen bytes at a time.
|
static void |
eachByte(InputStream is,
Closure closure)
Traverse through each byte of the specified stream.
|
static void |
eachByte(InputStream is,
int bufferLen,
Closure closure)
Traverse through each the specified stream reading bytes into a buffer
and calling the 2 parameter closure with this buffer and the number of bytes.
|
static void |
eachByte(URL url,
Closure closure)
Reads the InputStream from this URL, passing each byte to the given
closure.
|
static void |
eachByte(URL url,
int bufferLen,
Closure closure)
Reads the InputStream from this URL, passing a byte[] and a number of bytes
to the given closure.
|
static void |
eachDir(File self,
Closure closure)
Invokes the closure for each subdirectory in this directory,
ignoring regular files.
|
static void |
eachDirMatch(File self,
Object nameFilter,
Closure closure)
Invokes the closure for each subdirectory whose name (dir.name) matches the given nameFilter in the given directory
- calling the
isCase(java.lang.Object, java.lang.Object) method to determine if a match occurs. |
static void |
eachDirRecurse(File self,
Closure closure)
Invokes the closure for each descendant directory of this directory.
|
static void |
eachFile(File self,
Closure closure)
Invokes the closure for each 'child' file in this 'parent' folder/directory.
|
static void |
eachFile(File self,
FileType fileType,
Closure closure)
Invokes the closure for each 'child' file in this 'parent' folder/directory.
|
static void |
eachFileMatch(File self,
FileType fileType,
Object nameFilter,
Closure closure)
Invokes the closure for each file whose name (file.name) matches the given nameFilter in the given directory
- calling the
isCase(java.lang.Object, java.lang.Object) method to determine if a match occurs. |
static void |
eachFileMatch(File self,
Object nameFilter,
Closure closure)
Invokes the closure for each file whose name (file.name) matches the given nameFilter in the given directory
- calling the
isCase(java.lang.Object, java.lang.Object) method to determine if a match occurs. |
static void |
eachFileRecurse(File self,
Closure closure)
Invokes the closure for each descendant file in this directory.
|
static void |
eachFileRecurse(File self,
FileType fileType,
Closure closure)
Invokes the closure for each descendant file in this directory.
|
static <T> T |
eachLine(CharSequence self,
Closure<T> closure)
Iterates through this CharSequence line by line.
|
static <T> T |
eachLine(CharSequence self,
int firstLine,
Closure<T> closure)
Iterates through this CharSequence line by line.
|
static <T> T |
eachLine(File self,
Closure<T> closure)
Iterates through this file line by line.
|
static <T> T |
eachLine(File self,
int firstLine,
Closure<T> closure)
Iterates through this file line by line.
|
static <T> T |
eachLine(File self,
String charset,
Closure<T> closure)
Iterates through this file line by line.
|
static <T> T |
eachLine(File self,
String charset,
int firstLine,
Closure<T> closure)
Iterates through this file line by line.
|
static <T> T |
eachLine(InputStream stream,
Closure<T> closure)
Iterates through this stream, passing each line to the given 1 or 2 arg closure.
|
static <T> T |
eachLine(InputStream stream,
int firstLine,
Closure<T> closure)
Iterates through this stream, passing each line to the given 1 or 2 arg closure.
|
static <T> T |
eachLine(InputStream stream,
String charset,
Closure<T> closure)
Iterates through this stream reading with the provided charset, passing each line to the
given 1 or 2 arg closure.
|
static <T> T |
eachLine(InputStream stream,
String charset,
int firstLine,
Closure<T> closure)
Iterates through this stream reading with the provided charset, passing each line to
the given 1 or 2 arg closure.
|
static <T> T |
eachLine(Reader self,
Closure<T> closure)
Iterates through the given reader line by line.
|
static <T> T |
eachLine(Reader self,
int firstLine,
Closure<T> closure)
Iterates through the given reader line by line.
|
static <T> T |
eachLine(String self,
Closure<T> closure)
Iterates through this String line by line.
|
static <T> T |
eachLine(String self,
int firstLine,
Closure<T> closure)
Iterates through this String line by line.
|
static <T> T |
eachLine(URL url,
Closure<T> closure)
Iterates through the lines read from the URL's associated input stream passing each
line to the given 1 or 2 arg closure.
|
static <T> T |
eachLine(URL url,
int firstLine,
Closure<T> closure)
Iterates through the lines read from the URL's associated input stream passing each
line to the given 1 or 2 arg closure.
|
static <T> T |
eachLine(URL url,
String charset,
Closure<T> closure)
Iterates through the lines read from the URL's associated input stream passing each
line to the given 1 or 2 arg closure.
|
static <T> T |
eachLine(URL url,
String charset,
int firstLine,
Closure<T> closure)
Iterates through the lines read from the URL's associated input stream passing each
line to the given 1 or 2 arg closure.
|
static String |
eachMatch(CharSequence self,
CharSequence regex,
Closure closure)
Process each regex group matched substring of the given CharSequence.
|
static String |
eachMatch(CharSequence self,
Pattern pattern,
Closure closure)
Process each regex group matched substring of the given pattern.
|
static String |
eachMatch(String self,
Pattern pattern,
Closure closure)
Process each regex group matched substring of the given pattern.
|
static String |
eachMatch(String self,
String regex,
Closure closure)
Process each regex group matched substring of the given string.
|
static void |
eachObject(File self,
Closure closure)
Iterates through the given file object by object.
|
static void |
eachObject(ObjectInputStream ois,
Closure closure)
Iterates through the given object stream object by object.
|
static <T> Iterator<List<T>> |
eachPermutation(Collection<T> self,
Closure closure)
Iterates over all permutations of a collection, running a closure for each iteration.
|
static <K,V> Map<K,V> |
eachWithIndex(Map<K,V> self,
Closure closure)
Allows a Map to be iterated through using a closure.
|
static <T> T |
eachWithIndex(T self,
Closure closure)
Iterates through an aggregate type or data structure,
passing each item and the item's index (a counter starting at
zero) to the given closure.
|
static boolean |
equals(int[] left,
int[] right)
Compare the contents of this array to the contents of the given array.
|
static boolean |
equals(List left,
List right)
Compare the contents of two Lists.
|
static boolean |
equals(List left,
Object[] right)
Determines if the contents of this list are equal to the
contents of the given array in the same order.
|
static boolean |
equals(Map self,
Map other)
Compares two Maps treating coerced numerical values as identical.
|
static boolean |
equals(Object[] left,
List right)
Determines if the contents of this array are equal to the
contents of the given list, in the same order.
|
static <T> boolean |
equals(Set<T> self,
Set<T> other)
Compare the contents of two Sets for equality using Groovy's coercion rules.
|
static <K,V> boolean |
every(Map<K,V> self,
Closure closure)
Iterates over the entries of a map, and checks whether a predicate is
valid for all entries.
|
static boolean |
every(Object self)
Iterates over every element of a collection, and checks whether all
elements are
true according to the Groovy Truth. |
static boolean |
every(Object self,
Closure closure)
Used to determine if the given predicate closure is valid (i.e.
|
static Process |
execute(List commands)
Executes the command specified by the given list.
|
static Process |
execute(List commands,
List envp,
File dir)
Executes the command specified by the given list,
with the environment defined by
envp and under the working directory dir. |
static Process |
execute(List commands,
String[] envp,
File dir)
Executes the command specified by the given list,
with the environment defined by
envp and under the working directory dir. |
static Process |
execute(String self)
Executes the command specified by
self as a command-line process. |
static Process |
execute(String[] commandArray)
Executes the command specified by the given
String array. |
static Process |
execute(String[] commandArray,
List envp,
File dir)
Executes the command specified by the
String array given in the first parameter,
with the environment defined by envp and under the working directory dir. |
static Process |
execute(String[] commandArray,
String[] envp,
File dir)
Executes the command specified by the
String array given in the first parameter,
with the environment defined by envp and under the working directory dir. |
static Process |
execute(String self,
List envp,
File dir)
Executes the command specified by
self with environment defined
by envp and under the working directory dir. |
static Process |
execute(String self,
String[] envp,
File dir)
Executes the command specified by
self with environment defined by envp
and under the working directory dir. |
static CharSequence |
expand(CharSequence self)
Expands all tabs into spaces with tabStops of size 8.
|
static CharSequence |
expand(CharSequence self,
int tabStop)
Expands all tabs into spaces.
|
static String |
expand(String self)
Expands all tabs into spaces with tabStops of size 8.
|
static String |
expand(String self,
int tabStop)
Expands all tabs into spaces.
|
static CharSequence |
expandLine(CharSequence self,
int tabStop)
Expands all tabs into spaces.
|
static String |
expandLine(String self,
int tabStop)
Expands all tabs into spaces.
|
static Writable |
filterLine(File self,
Closure closure)
Filters the lines of a File and creates a Writable in return to
stream the filtered lines.
|
static Writable |
filterLine(File self,
String charset,
Closure closure)
Filters the lines of a File and creates a Writable in return to
stream the filtered lines.
|
static void |
filterLine(File self,
Writer writer,
Closure closure)
Filter the lines from this File, and write them to the given writer based
on the given closure predicate.
|
static void |
filterLine(File self,
Writer writer,
String charset,
Closure closure)
Filter the lines from this File, and write them to the given writer based
on the given closure predicate.
|
static Writable |
filterLine(InputStream self,
Closure predicate)
Filter lines from an input stream using a closure predicate.
|
static Writable |
filterLine(InputStream self,
String charset,
Closure predicate)
Filter lines from an input stream using a closure predicate.
|
static void |
filterLine(InputStream self,
Writer writer,
Closure predicate)
Uses a closure to filter lines from this InputStream and pass them to
the given writer.
|
static void |
filterLine(InputStream self,
Writer writer,
String charset,
Closure predicate)
Uses a closure to filter lines from this InputStream and pass them to
the given writer.
|
static Writable |
filterLine(Reader reader,
Closure closure)
Filter the lines from this Reader, and return a Writable which can be
used to stream the filtered lines to a destination.
|
static void |
filterLine(Reader reader,
Writer writer,
Closure closure)
Filter the lines from a reader and write them on the writer,
according to a closure which returns true if the line should be included.
|
static Writable |
filterLine(URL self,
Closure predicate)
Filter lines from a URL using a closure predicate.
|
static Writable |
filterLine(URL self,
String charset,
Closure predicate)
Filter lines from a URL using a closure predicate.
|
static void |
filterLine(URL self,
Writer writer,
Closure predicate)
Uses a closure to filter lines from this URL and pass them to
the given writer.
|
static void |
filterLine(URL self,
Writer writer,
String charset,
Closure predicate)
Uses a closure to filter lines from this URL and pass them to
the given writer.
|
static CharSequence |
find(CharSequence self,
CharSequence regex)
Finds the first occurrence of a regular expression CharSequence within a CharSequence.
|
static CharSequence |
find(CharSequence self,
CharSequence regex,
Closure closure)
Returns the result of calling a closure with the first occurrence of a regular expression found within a CharSequence.
|
static CharSequence |
find(CharSequence self,
Pattern pattern)
Finds the first occurrence of a compiled regular expression Pattern within a CharSequence.
|
static CharSequence |
find(CharSequence self,
Pattern pattern,
Closure closure)
Returns the result of calling a closure with the first occurrence of a regular expression found within a
CharSequence.
|
static <T> T |
find(Collection<T> self)
Finds the first item matching the IDENTITY Closure (i.e.
|
static <T> T |
find(Collection<T> self,
Closure closure)
Finds the first value matching the closure condition.
|
static <K,V> Map.Entry<K,V> |
find(Map<K,V> self,
Closure<?> closure)
Finds the first entry matching the closure condition.
|
static Object |
find(Object self)
Finds the first item matching the IDENTITY Closure (i.e.
|
static Object |
find(Object self,
Closure closure)
Finds the first value matching the closure condition
|
static String |
find(String self,
Pattern pattern)
Finds the first occurrence of a compiled regular expression Pattern within a String.
|
static String |
find(String self,
Pattern pattern,
Closure closure)
Returns the result of calling a closure with the first occurrence of a compiled regular expression found within a String.
|
static String |
find(String self,
String regex)
Finds the first occurrence of a regular expression String within a String.
|
static String |
find(String self,
String regex,
Closure closure)
Returns the result of calling a closure with the first occurrence of a regular expression found within a String.
|
static List<CharSequence> |
findAll(CharSequence self,
CharSequence regex)
Returns a (possibly empty) list of all occurrences of a regular expression (in CharSequence format) found within a CharSequence.
|
static <T> List<T> |
findAll(CharSequence self,
CharSequence regex,
Closure<T> closure)
Finds all occurrences of a capturing regular expression CharSequence within a CharSequence.
|
static List<CharSequence> |
findAll(CharSequence self,
Pattern pattern)
Returns a (possibly empty) list of all occurrences of a regular expression (in Pattern format) found within a CharSequence.
|
static <T> List<T> |
findAll(CharSequence self,
Pattern pattern,
Closure<T> closure)
Finds all occurrences of a compiled regular expression Pattern within a CharSequence.
|
static <T> Collection<T> |
findAll(Collection<T> self)
Finds the items matching the IDENTITY Closure (i.e.
|
static <T> Collection<T> |
findAll(Collection<T> self,
Closure closure)
Finds all values matching the closure condition.
|
static <K,V> Map<K,V> |
findAll(Map<K,V> self,
Closure closure)
Finds all entries matching the closure condition.
|
static Collection |
findAll(Object self)
Finds all items matching the IDENTITY Closure (i.e.
|
static Collection |
findAll(Object self,
Closure closure)
Finds all items matching the closure condition.
|
static List<String> |
findAll(String self,
Pattern pattern)
Returns a (possibly empty) list of all occurrences of a regular expression (in Pattern format) found within a String.
|
static <T> List<T> |
findAll(String self,
Pattern pattern,
Closure<T> closure)
Finds all occurrences of a compiled regular expression Pattern within a String.
|
static List<String> |
findAll(String self,
String regex)
Returns a (possibly empty) list of all occurrences of a regular expression (in String format) found within a String.
|
static <T> List<T> |
findAll(String self,
String regex,
Closure<T> closure)
Finds all occurrences of a regular expression string within a String.
|
static int |
findIndexOf(Object self,
Closure closure)
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 int |
findIndexOf(Object self,
int startIndex,
Closure closure)
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 List<Number> |
findIndexValues(Object self,
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 List<Number> |
findIndexValues(Object self,
Number startIndex,
Closure closure)
Iterates over the elements of an iterable collection of items, starting from
a specified startIndex, and returns the index values of the items that match
the condition specified in the closure.
|
static int |
findLastIndexOf(Object self,
Closure closure)
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 int |
findLastIndexOf(Object self,
int startIndex,
Closure closure)
Iterates over the elements of an iterable collection of items, starting
from a specified startIndex, and returns the index of the last item that
matches the condition specified in the closure.
|
static <T> T |
findResult(Collection<?> self,
Closure<T> closure)
Iterates through the collection calling the given closure for each item but stopping once the first non-null
result is found and returning that result.
|
static <T,U extends T,V extends T> |
findResult(Collection<?> self,
U defaultResult,
Closure<V> closure)
Iterates through the collection calling the given closure for each item but stopping once the first non-null
result is found and returning that result.
|
static <T> T |
findResult(Map<?,?> self,
Closure<T> closure)
Returns the first non-null closure result found by passing each map entry to the closure, otherwise null is returned.
|
static <T,U extends T,V extends T> |
findResult(Map<?,?> self,
U defaultResult,
Closure<V> closure)
Returns the first non-null closure result found by passing each map entry to the closure, otherwise the defaultResult is returned.
|
static Object |
findResult(Object self,
Closure closure)
Treats the object as iterable, iterating through the values it represents and returns the first non-null result obtained from calling the closure, otherwise returns null.
|
static Object |
findResult(Object self,
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 the defaultResult.
|
static <T> Collection<T> |
findResults(Collection<?> self,
Closure<T> filteringTransform)
Iterates through the collection transforming items using the supplied closure
and collecting any non-null results.
|
static <T> Collection<T> |
findResults(Map<?,?> self,
Closure<T> filteringTransform)
Iterates through the map transforming items using the supplied closure
and collecting any non-null results.
|
static <T> T |
first(List<T> self)
Returns the first item from the List.
|
static <T> T |
first(T[] self)
Returns the first item from the Object array.
|
static Collection |
flatten(boolean[] self)
Flatten an array.
|
static Collection |
flatten(byte[] self)
Flatten an array.
|
static Collection |
flatten(char[] self)
Flatten an array.
|
static Collection<?> |
flatten(Collection<?> self)
Flatten a collection.
|
static <T> Collection<T> |
flatten(Collection<T> self,
Closure<? extends T> flattenUsing)
Flatten a collection.
|
static Collection |
flatten(double[] self)
Flatten an array.
|
static Collection |
flatten(float[] self)
Flatten an array.
|
static Collection |
flatten(int[] self)
Flatten an array.
|
static Collection |
flatten(long[] self)
Flatten an array.
|
static Collection |
flatten(Object[] self)
Flatten an array.
|
static Collection |
flatten(short[] self)
Flatten an array.
|
static <K,V> V |
get(Map<K,V> map,
K key,
V defaultValue)
Looks up an item in a Map for the given key and returns the value - unless
there is no entry for the given key in which case add the default value
to the map and return that.
|
static boolean |
getAt(BitSet self,
int index)
Support the subscript operator for a Bitset
|
static BitSet |
getAt(BitSet self,
IntRange range)
Support retrieving a subset of a BitSet using a Range
|
static List<Boolean> |
getAt(boolean[] array,
Collection indices)
Support the subscript operator with a collection for a boolean array
|
static List<Boolean> |
getAt(boolean[] array,
IntRange range)
Support the subscript operator with an IntRange for a boolean array
|
static List<Boolean> |
getAt(boolean[] array,
ObjectRange range)
Support the subscript operator with an ObjectRange for a byte array
|
static List<Boolean> |
getAt(boolean[] array,
Range range)
Support the subscript operator with a range for a boolean array
|
static List<Byte> |
getAt(byte[] array,
Collection indices)
Support the subscript operator with a collection for a byte array
|
static List<Byte> |
getAt(byte[] array,
IntRange range)
Support the subscript operator with an IntRange for a byte array
|
static List<Byte> |
getAt(byte[] array,
ObjectRange range)
Support the subscript operator with an ObjectRange for a byte array
|
static List<Byte> |
getAt(byte[] array,
Range range)
Support the subscript operator with a range for a byte array
|
static List<Character> |
getAt(char[] array,
Collection indices)
Support the subscript operator with a collection for a char array
|
static List<Character> |
getAt(char[] array,
IntRange range)
Support the subscript operator with an IntRange for a char array
|
static List<Character> |
getAt(char[] array,
ObjectRange range)
Support the subscript operator with an ObjectRange for a char array
|
static List<Character> |
getAt(char[] array,
Range range)
Support the subscript operator with a range for a char array
|
static CharSequence |
getAt(CharSequence self,
Collection indices)
Select a List of characters from a CharSequence using a Collection
to identify the indices to be selected.
|
static CharSequence |
getAt(CharSequence text,
EmptyRange range)
Support the range subscript operator for CharSequence or StringBuffer with EmptyRange
|
static CharSequence |
getAt(CharSequence text,
int index)
Support the subscript operator for CharSequence.
|
static CharSequence |
getAt(CharSequence text,
IntRange range)
Support the range subscript operator for CharSequence or StringBuffer with IntRange
|
static CharSequence |
getAt(CharSequence text,
Range range)
Support the range subscript operator for CharSequence
|
static List |
getAt(Collection coll,
String property)
Support the subscript operator for Collection.
|
static List<Double> |
getAt(double[] array,
Collection indices)
Support the subscript operator with a collection for a double array
|
static List<Double> |
getAt(double[] array,
IntRange range)
Support the subscript operator with an IntRange for a double array
|
static List<Double> |
getAt(double[] array,
ObjectRange range)
Support the subscript operator with an ObjectRange for a double array
|
static List<Double> |
getAt(double[] array,
Range range)
Support the subscript operator with a range for a double array
|
static List<Float> |
getAt(float[] array,
Collection indices)
Support the subscript operator with a collection for a float array
|
static List<Float> |
getAt(float[] array,
IntRange range)
Support the subscript operator with an IntRange for a float array
|
static List<Float> |
getAt(float[] array,
ObjectRange range)
Support the subscript operator with an ObjectRange for a float array
|
static List<Float> |
getAt(float[] array,
Range range)
Support the subscript operator with a range for a float array
|
static List<Integer> |
getAt(int[] array,
Collection indices)
Support the subscript operator with a collection for an int array
|
static List<Integer> |
getAt(int[] array,
IntRange range)
Support the subscript operator with an IntRange for an int array
|
static List<Integer> |
getAt(int[] array,
ObjectRange range)
Support the subscript operator with an ObjectRange for an int array
|
static List<Integer> |
getAt(int[] array,
Range range)
Support the subscript operator with a range for an int array
|
static <T> T |
getAt(Iterator<T> self,
int idx)
Support the subscript operator for an Iterator.
|
static <T> List<T> |
getAt(List<T> self,
Collection indices)
Select a List of items from a List using a Collection to
identify the indices to be selected.
|
static <T> List<T> |
getAt(List<T> self,
EmptyRange range)
Support the range subscript operator for a List.
|
static <T> T |
getAt(List<T> self,
int idx)
Support the subscript operator for a List.
|
static <T> List<T> |
getAt(List<T> self,
Range range)
Support the range subscript operator for a List.
|
static List<Long> |
getAt(long[] array,
Collection indices)
Support the subscript operator with a collection for a long array
|
static List<Long> |
getAt(long[] array,
IntRange range)
Support the subscript operator with an IntRange for a long array
|
static List<Long> |
getAt(long[] array,
ObjectRange range)
Support the subscript operator with an ObjectRange for a long array
|
static List<Long> |
getAt(long[] array,
Range range)
Support the subscript operator with a range for a long array
|
static <K,V> V |
getAt(Map<K,V> self,
K key)
Support the subscript operator for a Map.
|
static List |
getAt(Matcher self,
Collection indices)
Select a List of values from a Matcher using a Collection
to identify the indices to be selected.
|
static Object |
getAt(Matcher matcher,
int idx)
Support the subscript operator, e.g.
|
static Object |
getAt(Object self,
String property)
Allows the subscript operator to be used to lookup dynamic property values.
|
static List<Short> |
getAt(short[] array,
Collection indices)
Support the subscript operator with a collection for a short array
|
static List<Short> |
getAt(short[] array,
IntRange range)
Support the subscript operator with an IntRange for a short array
|
static List<Short> |
getAt(short[] array,
ObjectRange range)
Support the subscript operator with an ObjectRange for a short array
|
static List<Short> |
getAt(short[] array,
Range range)
Support the subscript operator with a range for a short array
|
static String |
getAt(String self,
Collection indices)
Select a List of characters from a String using a Collection
to identify the indices to be selected.
|
static String |
getAt(String text,
EmptyRange range)
Support the range subscript operator for String with EmptyRange
|
static String |
getAt(String text,
int index)
Support the subscript operator for String.
|
static String |
getAt(String text,
IntRange range)
Support the range subscript operator for String with IntRange
|
static String |
getAt(String text,
Range range)
Support the range subscript operator for String
|
static <T> List<T> |
getAt(T[] self,
Collection indices)
Select a List of items from an Object array using a Collection to
identify the indices to be selected.
|
static <T> List<T> |
getAt(T[] array,
EmptyRange range) |
static <T> List<T> |
getAt(T[] array,
IntRange range) |
static <T> List<T> |
getAt(T[] array,
ObjectRange range) |
static <T> List<T> |
getAt(T[] array,
Range range)
Support the range subscript operator for an Array
|
static byte[] |
getBytes(File file)
Read the content of the File and returns it as a byte[].
|
static byte[] |
getBytes(InputStream is)
Read the content of this InputStream and return it as a byte[].
|
static byte[] |
getBytes(URL url)
Read the content of this URL and returns it as a byte[].
|
static char[] |
getChars(CharSequence self)
Converts the given CharSequence into an array of characters.
|
static char[] |
getChars(String self)
Converts the given String into an array of characters.
|
static int |
getCount(Matcher matcher)
Find the number of Strings matched to the given Matcher.
|
static MetaClass |
getMetaClass(Class c)
Adds a "metaClass" property to all class objects so you can use the syntax
String.metaClass.myMethod = { println "foo" } |
static MetaClass |
getMetaClass(GroovyObject obj)
Obtains a MetaClass for an object either from the registry or in the case of
a GroovyObject from the object itself.
|
static MetaClass |
getMetaClass(Object obj)
Obtains a MetaClass for an object either from the registry or in the case of
a GroovyObject from the object itself.
|
static List<PropertyValue> |
getMetaPropertyValues(Object self)
Retrieves the list of
MetaProperty objects for 'self' and wraps it
in a list of PropertyValue objects that additionally provide
the value for each property of 'self'. |
static Map |
getProperties(Object self)
Convenience method that calls
getMetaPropertyValues(java.lang.Object)(self)
and provides the data in form of simple key/value pairs, i.e. |
static ClassLoader |
getRootLoader(ClassLoader self)
Iterates through the classloader parents until it finds a loader with a class
named "org.codehaus.groovy.tools.RootLoader".
|
protected static List |
getSubList(List self,
List splice) |
static String |
getText(BufferedReader reader)
Read the content of the BufferedReader and return it as a String.
|
static String |
getText(File file)
Read the content of the File and returns it as a String.
|
static String |
getText(File file,
String charset)
Read the content of the File using the specified encoding and return it
as a String.
|
static String |
getText(InputStream is)
Read the content of this InputStream and return it as a String.
|
static String |
getText(InputStream is,
String charset)
Read the content of this InputStream using specified charset and return
it as a String.
|
static String |
getText(Reader reader)
Read the content of the Reader and return it as a String.
|
static String |
getText(URL url)
Read the content of this URL and returns it as a String.
|
static String |
getText(URL url,
Map parameters)
Read the content of this URL and returns it as a String.
|
static String |
getText(URL url,
Map parameters,
String charset)
Read the data from this URL and return it as a String.
|
static String |
getText(URL url,
String charset)
Read the data from this URL and return it as a String.
|
static Collection |
grep(Object self)
Iterates over the collection of items which this Object represents and returns each item that matches
using the IDENTITY Closure as a filter - effectively returning all elements which satisfy Groovy truth.
|
static Collection |
grep(Object self,
Object filter)
Iterates over the collection of items which this Object represents and returns each item that matches
the given filter - calling the
method used by switch statements. |
protected static <K,T> void |
groupAnswer(Map<K,List<T>> answer,
T element,
K value)
Groups the current element according to the value
|
static <K,T> Map<K,List<T>> |
groupBy(Collection<T> self,
Closure<K> closure)
Sorts all collection members into groups determined by the
supplied mapping closure.
|
static Map |
groupBy(Collection self,
List<Closure> closures)
Sorts all collection members into (sub)groups determined by the supplied
mapping closures.
|
static Map |
groupBy(Collection self,
Object... closures)
Sorts all collection members into (sub)groups determined by the supplied
mapping closures.
|
static <G,K,V> Map<G,Map<K,V>> |
groupBy(Map<K,V> self,
Closure<G> closure)
Groups the members of a map into sub maps determined by the
supplied mapping closure.
|
static Map<Object,Map> |
groupBy(Map self,
List<Closure> closures)
Groups the members of a map into sub maps determined by the supplied
mapping closures.
|
static Map<Object,Map> |
groupBy(Map self,
Object... closures)
Groups the members of a map into sub maps determined by the supplied
mapping closures.
|
static <G,K,V> Map<G,List<Map.Entry<K,V>>> |
groupEntriesBy(Map<K,V> self,
Closure<G> closure)
Groups all map entries into groups determined by the
supplied mapping closure.
|
static boolean |
hasGroup(Matcher matcher)
Check whether a Matcher contains a group or not.
|
static MetaProperty |
hasProperty(Object self,
String name)
Returns true of the implementing MetaClass has a property of the given name
Note that this method will only return true for realised properties and does not take into
account implementation of getProperty or propertyMissing
|
static <T> T |
head(List<T> self)
Returns the first item from the List.
|
static <T> T |
head(T[] self)
Returns the first item from the Object array.
|
static <T> T |
identity(Object self,
Closure<T> closure)
Allows the closure to be called for the object reference self.
|
static Boolean |
implies(Boolean left,
Boolean right)
Logical implication of two boolean operators
|
static <T,U extends T,V extends T> |
inject(Collection self,
U initialValue,
Closure<V> closure)
Iterates through the given Collection, passing in the initial value to
the 2-arg closure along with the first item.
|
static <T,U extends T,V extends T> |
inject(Iterator self,
U initialValue,
Closure<V> closure)
Iterates through the given Iterator, passing in the initial value to
the closure along with the first item.
|
static <T,U extends T,V extends T> |
inject(Map<?,?> self,
U initialValue,
Closure<V> closure)
Iterates through the given Map, passing in the initial value to
the 2-arg Closure along with the first item (or 3-arg Closure along with the first key and value).
|
static <T,U extends T,V extends T> |
inject(Object[] self,
U initialValue,
Closure<V> closure)
Iterates through the given array, passing in the initial value to
the closure along with the first item.
|
static <T,U extends T,V extends T> |
inject(Object self,
U initialValue,
Closure<V> closure)
Iterates through the given Object, passing in the initial value to
the closure along with the first item.
|
static String |
inspect(Object self)
Inspects returns the String that matches what would be typed into a
terminal to create this object.
|
static Number |
intdiv(Character left,
Character right)
Integer Divide two Characters.
|
static Number |
intdiv(Character left,
Number right)
Integer Divide a Character by a Number.
|
static Number |
intdiv(Number left,
Character right)
Integer Divide a Number by a Character.
|
static Number |
intdiv(Number left,
Number right)
Integer Divide two Numbers.
|
static <T> Collection<T> |
intersect(Collection<T> left,
Collection<T> right)
Create a Collection composed of the intersection of both collections.
|
static <K,V> Map<K,V> |
intersect(Map<K,V> left,
Map<K,V> right)
Create a Map composed of the intersection of both maps.
|
static Object |
invokeMethod(Object object,
String method,
Object arguments)
Provide a dynamic method invocation method which can be overloaded in
classes to implement dynamic proxies easily.
|
static boolean |
is(Object self,
Object other)
Identity check.
|
static boolean |
isAllWhitespace(CharSequence self)
True if a CharSequence only contains whitespace characters.
|
static boolean |
isAllWhitespace(String self)
True if a String only contains whitespace characters.
|
static boolean |
isBigDecimal(CharSequence self)
Determine if a CharSequence can be parsed as a BigDecimal.
|
static boolean |
isBigDecimal(String self)
Determine if a String can be parsed into a BigDecimal.
|
static boolean |
isBigInteger(CharSequence self)
Determine if a CharSequence can be parsed as a BigInteger.
|
static boolean |
isBigInteger(String self)
Determine if a String can be parsed into a BigInteger.
|
static boolean |
isCase(CharSequence caseValue,
Object switchValue)
'Case' implementation for a CharSequence, which simply calls the equivalent method for String.
|
static boolean |
isCase(Class caseValue,
Object switchValue)
Special 'Case' implementation for Class, which allows testing
for a certain class in a switch statement.
|
static boolean |
isCase(Collection caseValue,
Object switchValue)
'Case' implementation for collections which tests if the 'switch'
operand is contained in any of the 'case' values.
|
static boolean |
isCase(GString caseValue,
Object switchValue)
'Case' implementation for a GString, which simply calls the equivalent method for String.
|
static boolean |
isCase(Map caseValue,
Object switchValue)
'Case' implementation for maps which tests the groovy truth
value obtained using the 'switch' operand as key.
|
static boolean |
isCase(Number caseValue,
Number switchValue)
Special 'case' implementation for all numbers, which delegates to the
compareTo() method for comparing numbers of different
types. |
static boolean |
isCase(Object caseValue,
Object switchValue)
Method for overloading the behavior of the 'case' method in switch statements.
|
static boolean |
isCase(Pattern caseValue,
Object switchValue)
'Case' implementation for the
Pattern class, which allows
testing a String against a number of regular expressions. |
static boolean |
isCase(String caseValue,
Object switchValue)
'Case' implementation for a String, which uses String#equals(Object)
in order to allow Strings to be used in switch statements.
|
static boolean |
isDigit(Character self)
Determines if a character is a digit.
|
static boolean |
isDouble(CharSequence self)
Determine if a CharSequence can be parsed as a Double.
|
static boolean |
isDouble(String self)
Determine if a String can be parsed into a Double.
|
static boolean |
isFloat(CharSequence self)
Determine if a CharSequence can be parsed as a Float.
|
static boolean |
isFloat(String self)
Determine if a String can be parsed into a Float.
|
static boolean |
isInteger(CharSequence self)
Determine if a CharSequence can be parsed as an Integer.
|
static boolean |
isInteger(String self)
Determine if a String can be parsed into an Integer.
|
static boolean |
isLetter(Character self)
Determines if a character is a letter.
|
static boolean |
isLetterOrDigit(Character self)
Determines if a character is a letter or digit.
|
static boolean |
isLong(CharSequence self)
Determine if a CharSequence can be parsed as a Long.
|
static boolean |
isLong(String self)
Determine if a String can be parsed into a Long.
|
static boolean |
isLowerCase(Character self)
Determine if a Character is lowercase.
|
static boolean |
isNumber(CharSequence self)
Determine if a CharSequence can be parsed as a Number.
|
static boolean |
isNumber(String self)
Determine if a String can be parsed into a Number.
|
static boolean |
isUpperCase(Character self)
Determine if a Character is uppercase.
|
static boolean |
isWhitespace(Character self)
Determines if a character is a whitespace character.
|
static Iterator<Byte> |
iterator(DataInputStream self)
Standard iterator for a data input stream which iterates through the
stream content a Byte at a time.
|
static <T> Iterator<T> |
iterator(Enumeration<T> enumeration)
Allows an Enumeration to behave like an Iterator.
|
static Iterator<Byte> |
iterator(InputStream self)
Standard iterator for a input stream which iterates through the stream
content in a byte-based fashion.
|
static <T> Iterator<T> |
iterator(Iterator<T> self)
An identity function for iterators, supporting 'duck-typing' when trying to get an
iterator for each object within a collection, some of which may already be iterators.
|
static Iterator |
iterator(Matcher matcher)
Returns an
Iterator which traverses each match. |
static Iterator |
iterator(Object o)
Attempts to create an Iterator for the given object by first
converting it to a Collection.
|
static Iterator<String> |
iterator(Reader self)
Creates an iterator which will traverse through the reader a line at a time.
|
static <T> Iterator<T> |
iterator(T[] a)
Attempts to create an Iterator for the given object by first
converting it to a Collection.
|
static String |
join(Collection self,
String separator)
Concatenates the
toString() representation of each
item in this collection, with the given String as a separator between
each item. |
static String |
join(Iterator<Object> self,
String separator)
Concatenates the
toString() representation of each
item from the iterator, with the given String as a separator between
each item. |
static String |
join(Object[] self,
String separator)
Concatenates the
toString() representation of each
items in this array, with the given String as a separator between each
item. |
static <T> T |
last(List<T> self)
Returns the last item from the List.
|
static <T> T |
last(T[] self)
Returns the last item from the Object array.
|
static <T> BlockingQueue<T> |
leftShift(BlockingQueue<T> self,
T value)
Overloads the left shift operator to provide an easy way to append
objects to a BlockingQueue.
|
static StringBuilder |
leftShift(CharSequence self,
Object value)
Overloads the left shift operator to provide an easy way to append multiple
objects as string representations to a CharSequence.
|
static <T> Collection<T> |
leftShift(Collection<T> self,
T value)
Overloads the left shift operator to provide an easy way to append
objects to a Collection.
|
static File |
leftShift(File file,
byte[] bytes)
Write bytes to a File.
|
static File |
leftShift(File file,
InputStream data)
Append binary data to the file.
|
static File |
leftShift(File file,
Object text)
Write the text to the File.
|
static <K,V> Map<K,V> |
leftShift(Map<K,V> self,
Map.Entry<K,V> entry)
Overloads the left shift operator to provide an easy way to append
Map.Entry values to a Map.
|
static <K,V> Map<K,V> |
leftShift(Map<K,V> self,
Map<K,V> other)
Overloads the left shift operator to provide an easy way to put
one maps entries into another map.
|
static Number |
leftShift(Number self,
Number operand)
Implementation of the left shift operator for integral types.
|
static void |
leftShift(ObjectOutputStream self,
Object value)
Overloads the leftShift operator to add objects to an ObjectOutputStream.
|
static OutputStream |
leftShift(OutputStream self,
byte[] value)
Overloads the leftShift operator to provide an append mechanism to add bytes to a stream.
|
static OutputStream |
leftShift(OutputStream self,
InputStream in)
Pipe an InputStream into an OutputStream for efficient stream copying.
|
static Writer |
leftShift(OutputStream self,
Object value)
Overloads the leftShift operator to provide an append mechanism to add values to a stream.
|
static OutputStream |
leftShift(Socket self,
byte[] value)
Overloads the left shift operator to provide an append mechanism
to add bytes to the output stream of a socket
|
static Writer |
leftShift(Socket self,
Object value)
Overloads the left shift operator to provide an append mechanism to
add things to the output stream of a socket
|
static StringBuffer |
leftShift(StringBuffer self,
Object value)
Overloads the left shift operator to provide an easy way to append multiple
objects as string representations to a StringBuffer.
|
static StringBuilder |
leftShift(StringBuilder self,
Object value)
Overloads the left shift operator to provide syntactic sugar for appending to a StringBuilder.
|
static StringBuffer |
leftShift(String self,
Object value)
Overloads the left shift operator to provide an easy way to append multiple
objects as string representations to a String.
|
static Writer |
leftShift(Writer self,
Object value)
Overloads the left shift operator to provide a mechanism to append
values to a writer.
|
static boolean |
matches(CharSequence self,
Pattern pattern)
Tells whether or not a CharSequence matches the given
compiled regular expression Pattern.
|
static boolean |
matches(String self,
Pattern pattern)
Tells whether or not self matches the given
compiled regular expression Pattern.
|
static <T> T |
max(Collection<T> self)
Adds max() method to Collection objects.
|
static <T> T |
max(Collection<T> self,
Closure closure)
Selects an item in the collection having the maximum
value as determined by the supplied closure.
|
static <T> T |
max(Collection<T> self,
Comparator<T> comparator)
Selects the maximum value found in the collection using the given comparator.
|
static <T> T |
max(Iterator<T> self)
Adds max() method to Iterator objects.
|
static <T> T |
max(Iterator<T> self,
Closure closure)
Selects the maximum value found from the Iterator
using the closure to determine the correct ordering.
|
static <T> T |
max(Iterator<T> self,
Comparator<T> comparator)
Selects the maximum value found from the Iterator using the given comparator.
|
static <K,V> Map.Entry<K,V> |
max(Map<K,V> self,
Closure closure)
Selects an entry in the map having the maximum
calculated value as determined by the supplied closure.
|
static <T> T |
max(T[] self)
Adds max() method to Object arrays.
|
static <T> T |
max(T[] self,
Closure closure)
Selects the maximum value found from the Object array
using the closure to determine the correct ordering.
|
static <T> T |
max(T[] self,
Comparator<T> comparator)
Selects the maximum value found from the Object array using the given comparator.
|
static MetaClass |
metaClass(Class self,
Closure closure)
Sets/updates the metaclass for a given class to a closure.
|
static MetaClass |
metaClass(Object self,
Closure closure)
Sets/updates the metaclass for a given object to a closure.
|
static <T> T |
min(Collection<T> self)
Adds min() method to Collection objects.
|
static <T> T |
min(Collection<T> self,
Closure closure)
Selects an item in the collection having the minimum
value as determined by the supplied closure.
|
static <T> T |
min(Collection<T> self,
Comparator<T> comparator)
Selects the minimum value found in the collection using the given comparator.
|
static <T> T |
min(Iterator<T> self)
Adds min() method to Iterator objects.
|
static <T> T |
min(Iterator<T> self,
Closure closure)
Selects the minimum value found from the Iterator
using the closure to determine the correct ordering.
|
static <T> T |
min(Iterator<T> self,
Comparator<T> comparator)
Selects the minimum value found from the Iterator using the given comparator.
|
static <K,V> Map.Entry<K,V> |
min(Map<K,V> self,
Closure closure)
Selects an entry in the map having the minimum
calculated value as determined by the supplied closure.
|
static <T> T |
min(T[] self)
Adds min() method to Object arrays.
|
static <T> T |
min(T[] self,
Closure closure)
Selects the minimum value found from the Object array
using the closure to determine the correct ordering.
|
static <T> T |
min(T[] self,
Comparator<T> comparator)
Selects the minimum value found from the Object array using the given comparator.
|
static Number |
minus(Character left,
Character right)
Subtract one Character from another.
|
static Number |
minus(Character left,
Number right)
Subtract a Number from a Character.
|
static CharSequence |
minus(CharSequence self,
Object target)
Remove a part of a CharSequence by replacing the first occurrence
of target within self with '' and returns the result.
|
static <T> List<T> |
minus(List<T> self,
Collection<T> removeMe)
Create a List composed of the elements of the first list minus
every occurrence of elements of the given collection.
|
static <T> List<T> |
minus(List<T> self,
Object operand)
Create a new List composed of the elements of the first list minus every occurrence of the
operand.
|
static <K,V> Map<K,V> |
minus(Map<K,V> self,
Map<K,V> operands)
Create a Map composed of the entries of the first map minus the
entries of the given map.
|
static Number |
minus(Number left,
Character right)
Subtract a Character from a Number.
|
static <T> Set<T> |
minus(Set<T> self,
Collection operands)
Create a Set composed of the elements of the first set minus the
elements of the given collection.
|
static <T> Set<T> |
minus(Set<T> self,
Object operand)
Create a Set composed of the elements of the first set minus the operand.
|
static String |
minus(String self,
Object target)
Remove a part of a String.
|
static <T> T[] |
minus(T[] self,
Collection<T> removeMe)
Create an array composed of the elements of the first array minus the
elements of the given collection.
|
static <T> T[] |
minus(T[] self,
Object operand)
Create a new object array composed of the elements of the first array
minus the operand.
|
static <T> T[] |
minus(T[] self,
T[] removeMe)
Create an array composed of the elements of the first array minus the
elements of the given array.
|
static void |
mixin(Class self,
Class categoryClass)
Extend class globally with category methods.
|
static void |
mixin(Class self,
Class[] categoryClass)
Extend class globally with category methods.
|
static void |
mixin(Class self,
List<Class> categoryClasses)
Extend class globally with category methods.
|
static void |
mixin(MetaClass self,
Class categoryClass)
Extend class globally with category methods.
|
static void |
mixin(MetaClass self,
Class[] categoryClass)
Extend class globally with category methods.
|
static void |
mixin(MetaClass self,
List<Class> categoryClasses)
Extend object with category methods.
|
static Number |
mod(Number left,
Number right)
Performs a division modulus operation.
|
static Number |
multiply(BigDecimal left,
BigInteger right)
Multiply a BigDecimal and a BigInteger.
|
static Number |
multiply(BigDecimal left,
Double right)
Multiply a BigDecimal and a Double.
|
static Number |
multiply(Character left,
Character right)
Multiply two Characters.
|
static Number |
multiply(Character left,
Number right)
Multiply a Character by a Number.
|
static CharSequence |
multiply(CharSequence self,
Number factor)
Repeat a CharSequence a certain number of times.
|
static <T> List<T> |
multiply(Collection<T> self,
Number factor)
Create a List composed of the elements of this list, repeated
a certain number of times.
|
static Number |
multiply(Number left,
Character right)
Multiply a Number by a Character.
|
static String |
multiply(String self,
Number factor)
Repeat a String a certain number of times.
|
static DataInputStream |
newDataInputStream(File file)
Create a data input stream for this file
|
static DataOutputStream |
newDataOutputStream(File file)
Creates a new data output stream for this file.
|
static BufferedInputStream |
newInputStream(File file)
Creates a buffered input stream for this file.
|
static BufferedInputStream |
newInputStream(URL url)
Creates a buffered input stream for this URL.
|
static BufferedInputStream |
newInputStream(URL url,
Map parameters)
Creates a buffered input stream for this URL.
|
static <T> T |
newInstance(Class<T> c)
Convenience method to dynamically create a new instance of this
class.
|
static <T> T |
newInstance(Class<T> c,
Object[] args)
Helper to construct a new instance from the given arguments.
|
static ObjectInputStream |
newObjectInputStream(File file)
Create an object input stream for this file.
|
static ObjectInputStream |
newObjectInputStream(File file,
ClassLoader classLoader)
Create an object input stream for this file using the given class loader.
|
static ObjectInputStream |
newObjectInputStream(InputStream inputStream)
Create an object input stream for this input stream.
|
static ObjectInputStream |
newObjectInputStream(InputStream inputStream,
ClassLoader classLoader)
Create an object input stream for this input stream using the given class loader.
|
static ObjectOutputStream |
newObjectOutputStream(File file)
Create an object output stream for this file.
|
static ObjectOutputStream |
newObjectOutputStream(OutputStream outputStream)
Create an object output stream for this output stream.
|
static BufferedOutputStream |
newOutputStream(File file)
Create a buffered output stream for this file.
|
static PrintWriter |
newPrintWriter(File file)
Create a new PrintWriter for this file.
|
static PrintWriter |
newPrintWriter(File file,
String charset)
Create a new PrintWriter for this file, using specified
charset.
|
static PrintWriter |
newPrintWriter(Writer writer)
Create a new PrintWriter for this file, using specified
charset.
|
static BufferedReader |
newReader(File file)
Create a buffered reader for this file.
|
static BufferedReader |
newReader(File file,
String charset)
Create a buffered reader for this file, using the specified
charset as the encoding.
|
static BufferedReader |
newReader(InputStream self)
Creates a reader for this input stream.
|
static BufferedReader |
newReader(InputStream self,
String charset)
Creates a reader for this input stream, using the specified
charset as the encoding.
|
static BufferedReader |
newReader(URL url)
Creates a buffered reader for this URL.
|
static BufferedReader |
newReader(URL url,
Map parameters)
Creates a buffered reader for this URL.
|
static BufferedReader |
newReader(URL url,
Map parameters,
String charset)
Creates a buffered reader for this URL using the given encoding.
|
static BufferedReader |
newReader(URL url,
String charset)
Creates a buffered reader for this URL using the given encoding.
|
static BufferedWriter |
newWriter(File file)
Create a buffered writer for this file.
|
static BufferedWriter |
newWriter(File file,
boolean append)
Creates a buffered writer for this file, optionally appending to the
existing file content.
|
static BufferedWriter |
newWriter(File file,
String charset)
Creates a buffered writer for this file, writing data using the given
encoding.
|
static BufferedWriter |
newWriter(File file,
String charset,
boolean append)
Helper method to create a buffered writer for a file.
|
static Character |
next(Character self)
Increment a Character by one.
|
static CharSequence |
next(CharSequence self)
This method is called by the ++ operator for the class CharSequence.
|
static Number |
next(Number self)
Increment a Number by one.
|
static String |
next(String self)
This method is called by the ++ operator for the class String.
|
static CharSequence |
normalize(CharSequence self)
Return a CharSequence with linefeeds and carriage returns normalized to linefeeds.
|
static String |
normalize(String self)
Return a String with linefeeds and carriage returns normalized to linefeeds.
|
static int |
numberAwareCompareTo(Comparable self,
Comparable other)
Provides a method that compares two comparables using Groovy's
default number aware comparator.
|
static BitSet |
or(BitSet left,
BitSet right)
Bitwise OR together two BitSets.
|
static Boolean |
or(Boolean left,
Boolean right)
Logical disjunction of two boolean operators
|
static Number |
or(Number left,
Number right)
Bitwise OR together two numbers.
|
static CharSequence |
padLeft(CharSequence self,
Number numberOfChars)
Pad a CharSequence to a minimum length specified by numberOfChars by adding the space character to the left as many times as needed.
|
static CharSequence |
padLeft(CharSequence self,
Number numberOfChars,
CharSequence padding)
Pad a CharSequence to a minimum length specified by numberOfChars, adding the supplied padding CharSequence as many times as needed to the left.
|
static String |
padLeft(String self,
Number numberOfChars)
Pad a String to a minimum length specified by numberOfChars by adding the space character to the left as many times as needed.
|
static String |
padLeft(String self,
Number numberOfChars,
String padding)
Pad a String to a minimum length specified by numberOfChars, adding the supplied padding String as many times as needed to the left.
|
static CharSequence |
padRight(CharSequence self,
Number numberOfChars)
Pad a CharSequence to a minimum length specified by numberOfChars by adding the space character to the right as many times as needed.
|
static CharSequence |
padRight(CharSequence self,
Number numberOfChars,
CharSequence padding)
Pad a CharSequence to a minimum length specified by numberOfChars, adding the supplied padding CharSequence as many times as needed to the right.
|
static String |
padRight(String self,
Number numberOfChars)
Pad a String to a minimum length specified by numberOfChars by adding the space character to the right as many times as needed.
|
static String |
padRight(String self,
Number numberOfChars,
String padding)
Pad a String to a minimum length specified by numberOfChars, adding the supplied padding String as many times as needed to the right.
|
static <T> Set<List<T>> |
permutations(List<T> self)
Finds all permutations of a collection.
|
static Number |
plus(Character left,
Character right)
Add one Character to another.
|
static Number |
plus(Character left,
Number right)
Add a Character and a Number.
|
static CharSequence |
plus(CharSequence left,
Object value)
Appends the String representation of the given operand to this string.
|
static <T> Collection<T> |
plus(Collection<T> left,
Collection<T> right)
Create a Collection as a union of two collections.
|
static <T> Collection<T> |
plus(Collection<T> left,
T right)
Create a collection as a union of a Collection and an Object.
|
static <T> List<T> |
plus(List<T> self,
int index,
List<T> additions)
Creates a new list by adding all of the elements in the specified list
to the elements from this list at the specified index.
|
static <T> List<T> |
plus(List<T> self,
int index,
T[] items)
Creates a new list by adding all of the elements in the specified array to the elements from the original list at the specified index.
|
static <K,V> Map<K,V> |
plus(Map<K,V> self,
Collection<Map.Entry<K,V>> entries)
Returns a new
Map containing all entries from self and entries,
giving precedence to entries. |
static <K,V> Map<K,V> |
plus(Map<K,V> left,
Map<K,V> right)
Returns a new
Map containing all entries from left and right,
giving precedence to right. |
static Number |
plus(Number left,
Character right)
Add a Number and a Character.
|
static String |
plus(Number value,
String right)
Appends a String to the string representation of this number.
|
static String |
plus(StringBuffer left,
String value)
Appends a String to this StringBuffer.
|
static String |
plus(String left,
Object value)
Appends the String representation of the given operand to this string.
|
static <T> T |
pop(List<T> self)
Removes the last item from the List.
|
static Number |
power(BigDecimal self,
Integer exponent)
Power of a BigDecimal to an integer certain exponent.
|
static Number |
power(BigInteger self,
Integer exponent)
Power of a BigInteger to an integer certain exponent.
|
static Number |
power(Integer self,
Integer exponent)
Power of an integer to an integer certain exponent.
|
static Number |
power(Long self,
Integer exponent)
Power of a long to an integer certain exponent.
|
static Number |
power(Number self,
Number exponent)
Power of a Number to a certain exponent.
|
static Character |
previous(Character self)
Decrement a Character by one.
|
static CharSequence |
previous(CharSequence self)
This method is called by the -- operator for the class CharSequence.
|
static Number |
previous(Number self)
Decrement a Number by one.
|
static String |
previous(String self)
This method is called by the -- operator for the class String.
|
protected static List |
primitiveArrayGet(Object self,
Collection indices)
Implements the getAt(Collection) method for primitive type arrays.
|
protected static Object |
primitiveArrayGet(Object self,
int idx)
Implements the getAt(int) method for primitive type arrays.
|
protected static List |
primitiveArrayGet(Object self,
Range range)
Implements the getAt(Range) method for primitive type arrays.
|
protected static Object |
primitiveArrayPut(Object self,
int idx,
Object newValue)
Implements the setAt(int idx) method for primitive type arrays.
|
static void |
print(Closure self,
Object value)
Print a value to the standard output stream.
|
static void |
print(Object self,
Object value)
Print a value formatted Groovy style to self if it
is a Writer, otherwise to the standard output stream.
|
static void |
print(Object self,
PrintWriter out)
Print to a console in interactive format.
|
static void |
print(PrintStream self,
Object value)
Print a value formatted Groovy style to the print stream.
|
static void |
print(PrintWriter self,
Object value)
Print a value formatted Groovy style to the print writer.
|
static void |
printf(Object self,
String format,
Object arg)
Prints a formatted string using the specified format string and
arguments.
|
static void |
printf(Object self,
String format,
Object[] values)
Printf to a console (Only works with JDK1.5 or later).
|
static void |
println(Closure self)
Print a linebreak to the standard output stream.
|
static void |
println(Closure self,
Object value)
Print a value (followed by a newline) to the standard output stream.
|
static void |
println(Object self)
Print a linebreak to the standard output stream.
|
static void |
println(Object self,
Object value)
Print a value formatted Groovy style (followed by a newline) to self
if it is a Writer, otherwise to the standard output stream.
|
static void |
println(Object self,
PrintWriter out)
Print to a console in interactive format.
|
static void |
println(PrintStream self,
Object value)
Print a value formatted Groovy style (followed by a newline) to the print stream.
|
static void |
println(PrintWriter self,
Object value)
Print a value formatted Groovy style (followed by a newline) to the print writer.
|
static <T> boolean |
push(List<T> self,
T value)
Appends an item to the List.
|
static <K,V> Map<K,V> |
putAll(Map<K,V> self,
Collection<Map.Entry<K,V>> entries)
Provides an easy way to append multiple Map.Entry values to a Map.
|
static void |
putAt(BitSet self,
int index,
boolean value)
Support subscript-style assignment for a BitSet.
|
static void |
putAt(BitSet self,
IntRange range,
boolean value)
Support assigning a range of values with a single assignment statement.
|
static <T> void |
putAt(List<T> self,
int idx,
T value)
A helper method to allow lists to work with subscript operators.
|
static void |
putAt(List self,
EmptyRange range,
Collection value)
A helper method to allow lists to work with subscript operators.
|
static void |
putAt(List self,
EmptyRange range,
Object value)
A helper method to allow lists to work with subscript operators.
|
static void |
putAt(List self,
IntRange range,
Collection col)
List subscript assignment operator when given a range as the index and
the assignment operand is a collection.
|
static void |
putAt(List self,
IntRange range,
Object value)
List subscript assignment operator when given a range as the index.
|
static void |
putAt(List self,
List splice,
List values)
A helper method to allow lists to work with subscript operators.
|
static void |
putAt(List self,
List splice,
Object value)
A helper method to allow lists to work with subscript operators.
|
static <K,V> V |
putAt(Map<K,V> self,
K key,
V value)
A helper method to allow maps to work with subscript operators
|
static void |
putAt(Object self,
String property,
Object newValue)
Allows the subscript operator to be used to set dynamically named property values.
|
static void |
putAt(StringBuffer self,
EmptyRange range,
Object value)
Support the range subscript operator for StringBuffer.
|
static void |
putAt(StringBuffer self,
IntRange range,
Object value)
Support the range subscript operator for StringBuffer.
|
static byte[] |
readBytes(File file)
Reads the content of the file into a byte array.
|
static String |
readLine(Reader self)
Read a single, whole line from the given Reader.
|
static List<CharSequence> |
readLines(CharSequence self)
Return the lines of a CharSequence as a List of CharSequence.
|
static List<String> |
readLines(File file)
Reads the file into a list of Strings, with one item for each line.
|
static List<String> |
readLines(File file,
String charset)
Reads the file into a list of Strings, with one item for each line.
|
static List<String> |
readLines(InputStream stream)
Reads the stream into a list, with one element for each line.
|
static List<String> |
readLines(InputStream stream,
String charset)
Reads the stream into a list, with one element for each line.
|
static List<String> |
readLines(Reader reader)
Reads the reader into a list of Strings, with one entry for each line.
|
static List<String> |
readLines(String self)
Return the lines of a String as a List of Strings.
|
static List<String> |
readLines(URL self)
Reads the URL contents into a list, with one element for each line.
|
static List<String> |
readLines(URL self,
String charset)
Reads the URL contents into a list, with one element for each line.
|
static boolean |
removeAll(Collection self,
Closure condition)
Modifies this collection by removing the elements that are matched according
to the specified closure condition.
|
static boolean |
removeAll(Collection self,
Object[] items)
Modifies this collection by removing its elements that are contained
within the specified object array.
|
static boolean |
renameTo(File self,
String newPathName)
Renames the file.
|
static CharSequence |
replaceAll(CharSequence self,
CharSequence regex,
CharSequence replacement)
Replaces each substring of this CharSequence that matches the given
regular expression with the given replacement.
|
static CharSequence |
replaceAll(CharSequence self,
CharSequence regex,
Closure closure)
Replaces all occurrences of a captured group by the result of a closure on that text.
|
static CharSequence |
replaceAll(CharSequence self,
Pattern pattern,
CharSequence replacement)
Replaces all substrings of a CharSequence that match the given
compiled regular expression with the given replacement.
|
static String |
replaceAll(CharSequence self,
Pattern pattern,
Closure closure)
Replaces all occurrences of a captured group by the result of a closure call on that text.
|
static String |
replaceAll(String self,
Pattern pattern,
Closure closure)
Replaces all occurrences of a captured group by the result of a closure call on that text.
|
static String |
replaceAll(String self,
Pattern pattern,
String replacement)
Replaces all substrings of a String that match the given
compiled regular expression with the given replacement.
|
static String |
replaceAll(String self,
String regex,
Closure closure)
Replaces all occurrences of a captured group by the result of a closure on that text.
|
static String |
replaceFirst(CharSequence self,
CharSequence regex,
CharSequence replacement)
Replaces the first substring of this CharSequence that matches the given
regular expression with the given replacement.
|
static String |
replaceFirst(CharSequence self,
CharSequence regex,
Closure closure)
Replaces the first occurrence of a captured group by the result of a closure call on that text.
|
static CharSequence |
replaceFirst(CharSequence self,
Pattern pattern,
CharSequence replacement)
Replaces the first substring of a CharSequence that matches the given
compiled regular expression with the given replacement.
|
static String |
replaceFirst(CharSequence self,
Pattern pattern,
Closure closure)
Replaces the first occurrence of a captured group by the result of a closure call on that text.
|
static String |
replaceFirst(String self,
Pattern pattern,
Closure closure)
Replaces the first occurrence of a captured group by the result of a closure call on that text.
|
static String |
replaceFirst(String self,
Pattern pattern,
String replacement)
Replaces the first substring of a String that matches the given
compiled regular expression with the given replacement.
|
static String |
replaceFirst(String self,
String regex,
Closure closure)
Replaces the first occurrence of a captured group by the result of a closure call on that text.
|
static List<MetaMethod> |
respondsTo(Object self,
String name)
Returns an object satisfying Groovy truth if the implementing MetaClass responds to
a method with the given name regardless of the arguments.
|
static List<MetaMethod> |
respondsTo(Object self,
String name,
Object[] argTypes)
Returns an object satisfying Groovy truth if the implementing MetaClass responds to
a method with the given name and arguments types.
|
static boolean |
retainAll(Collection self,
Closure condition)
Modifies this collection so that it retains only its elements
that are matched according to the specified closure condition.
|
static boolean |
retainAll(Collection self,
Object[] items)
Modifies this collection so that it retains only its elements that are contained
in the specified array.
|
static CharSequence |
reverse(CharSequence self)
Creates a new CharSequence which is the reverse (backwards) of this string
|
static <T> Iterator<T> |
reverse(Iterator<T> self)
Reverses the iterator.
|
static <T> List<T> |
reverse(List<T> self)
Creates a new List with the identical contents to this list
but in reverse order.
|
static <T> List<T> |
reverse(List<T> self,
boolean mutate)
Reverses the elements in a list.
|
static String |
reverse(String self)
Creates a new string which is the reverse (backwards) of this string
|
static <T> T[] |
reverse(T[] self)
Creates a new array containing items which are the same as this array but in reverse order.
|
static <T> T[] |
reverse(T[] self,
boolean mutate)
Reverse the items in an array.
|
static <T> List<T> |
reverseEach(List<T> self,
Closure closure)
Iterate over each element of the list in the reverse order.
|
static <K,V> Map<K,V> |
reverseEach(Map<K,V> self,
Closure closure)
Allows a Map to be iterated through in reverse order using a closure.
|
static <T> T[] |
reverseEach(T[] self,
Closure closure)
Iterate over each element of the array in the reverse order.
|
static Number |
rightShift(Number self,
Number operand)
Implementation of the right shift operator for integral types.
|
static Number |
rightShiftUnsigned(Number self,
Number operand)
Implementation of the right shift (unsigned) operator for integral types.
|
static long |
round(Double number)
Round the value
|
static double |
round(Double number,
int precision)
Round the value
|
static int |
round(Float number)
Round the value
|
static float |
round(Float number,
int precision)
Round the value
|
static TimerTask |
runAfter(Timer timer,
int delay,
Closure closure)
Allows a simple syntax for using timers.
|
static void |
setBytes(File file,
byte[] bytes)
Write the bytes from the byte array to the File.
|
static void |
setBytes(OutputStream os,
byte[] bytes)
Write the byte[] to the output stream.
|
static void |
setIndex(Matcher matcher,
int idx)
Set the position of the given Matcher to the given index.
|
static void |
setMetaClass(Class self,
MetaClass metaClass)
Sets the metaclass for a given class.
|
static void |
setMetaClass(Object self,
MetaClass metaClass)
Set the metaclass for an object
|
static void |
setText(File file,
String text)
Synonym for write(text) allowing file.text = 'foo'.
|
static void |
setText(File file,
String text,
String charset)
Synonym for write(text, charset) allowing:
myFile.setText('some text', charset)
or with some help from
ExpandoMetaClass, you could do something like:
myFile.metaClass.setText = { String s -> delegate.setText(s, 'UTF-8') }
myfile.text = 'some text'
|
static int |
size(boolean[] array)
Allows arrays to behave similar to collections.
|
static int |
size(byte[] array)
Allows arrays to behave similar to collections.
|
static int |
size(char[] array)
Allows arrays to behave similar to collections.
|
static int |
size(CharSequence text)
Provide the standard Groovy
size() method for CharSequence. |
static int |
size(double[] array)
Allows arrays to behave similar to collections.
|
static long |
size(File self)
Provide the standard Groovy
size() method for File. |
static int |
size(float[] array)
Allows arrays to behave similar to collections.
|
static int |
size(int[] array)
Allows arrays to behave similar to collections.
|
static int |
size(Iterator self)
Provide the standard Groovy
size() method for Iterator. |
static int |
size(long[] array)
Allows arrays to behave similar to collections.
|
static long |
size(Matcher self)
Provide the standard Groovy
size() method for Matcher. |
static int |
size(Object[] self)
Provide the standard Groovy
size() method for an array. |
static int |
size(short[] array)
Allows arrays to behave similar to collections.
|
static int |
size(String text)
Provide the standard Groovy
size() method for String. |
static int |
size(StringBuffer buffer)
Provide the standard Groovy
size() method for StringBuffer. |
static <T> List<T> |
sort(Collection<T> self)
Sorts the Collection.
|
static <T> List<T> |
sort(Collection<T> self,
boolean mutate)
Sorts the Collection.
|
static <T> List<T> |
sort(Collection<T> self,
boolean mutate,
Closure closure)
Sorts this Collection using the given Closure to determine the correct ordering.
|
static <T> List<T> |
sort(Collection<T> self,
boolean mutate,
Comparator<T> comparator)
Sorts the Collection using the given Comparator.
|
static <T> List<T> |
sort(Collection<T> self,
Closure closure)
Sorts this Collection using the given Closure to determine the correct ordering.
|
static <T> List<T> |
sort(Collection<T> self,
Comparator<T> comparator)
Sorts the Collection using the given Comparator.
|
static <T> Iterator<T> |
sort(Iterator<T> self)
Sorts the given iterator items into a sorted iterator.
|
static <T> Iterator<T> |
sort(Iterator<T> self,
Closure closure)
Sorts the given iterator items into a sorted iterator using the Closure to determine the correct ordering.
|
static <T> Iterator<T> |
sort(Iterator<T> self,
Comparator<T> comparator)
Sorts the given iterator items into a sorted iterator using the comparator.
|
static <K,V> Map<K,V> |
sort(Map<K,V> self)
Sorts the elements from the given map into a new ordered Map using
the natural ordering of the keys to determine the ordering.
|
static <K,V> Map<K,V> |
sort(Map<K,V> self,
Closure closure)
Sorts the elements from the given map into a new ordered map using
the closure as a comparator to determine the ordering.
|
static <K,V> Map<K,V> |
sort(Map<K,V> self,
Comparator<K> comparator)
Sorts the elements from the given map into a new ordered Map using
the specified key comparator to determine the ordering.
|
static <K,V> SortedMap<K,V> |
sort(SortedMap<K,V> self)
Avoids doing unnecessary work when sorting an already sorted map (i.e. an identity function for an already sorted map).
|
static <T> SortedSet<T> |
sort(SortedSet<T> self)
Avoids doing unnecessary work when sorting an already sorted set (i.e. an identity function for an already sorted set).
|
static <T> T[] |
sort(T[] self)
Modifies this array so that its elements are in sorted order.
|
static <T> T[] |
sort(T[] self,
boolean mutate)
Sorts the given array into sorted order.
|
static <T> T[] |
sort(T[] self,
boolean mutate,
Closure closure)
Modifies this array so that its elements are in sorted order using the Closure to determine the correct ordering.
|
static <T> T[] |
sort(T[] self,
boolean mutate,
Comparator<T> comparator)
Modifies this array so that its elements are in sorted order as determined by the given comparator.
|
static <T> T[] |
sort(T[] self,
Closure closure)
Sorts the elements from this array into a newly created array using
the Closure to determine the correct ordering.
|
static <T> T[] |
sort(T[] self,
Comparator<T> comparator)
Sorts the given array into sorted order using the given comparator.
|
static CharSequence[] |
split(CharSequence self)
Convenience method to split a CharSequence (with whitespace as delimiter).
|
static <T> Collection<Collection<T>> |
split(Collection<T> self,
Closure closure)
Splits all items into two collections based on the closure condition.
|
static String[] |
split(GString self)
Convenience method to split a GString (with whitespace as delimiter).
|
static Collection |
split(Object self,
Closure closure)
Splits all items into two lists based on the closure condition.
|
static String[] |
split(String self)
Convenience method to split a string (with whitespace as delimiter)
Like tokenize, but returns an Array of Strings instead of a List
|
static <T> T |
splitEachLine(CharSequence self,
CharSequence regex,
Closure<T> closure)
Iterates through the given CharSequence line by line, splitting each line using
the given separator.
|
static <T> T |
splitEachLine(CharSequence self,
Pattern pattern,
Closure<T> closure)
Iterates through the given CharSequence line by line, splitting each line using
the given separator Pattern.
|
static <T> T |
splitEachLine(File self,
Pattern pattern,
Closure<T> closure)
Iterates through this file line by line, splitting each line
|