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