Groovy JDK methods
New methods added to the JDK to make it more groovy.
boolean[]java.lang.Object | getAt(int idx) |
java.lang.Object | getAt(groovy.lang.Range range) |
java.lang.Object | getAt(groovy.lang.IntRange range) |
java.lang.Object | getAt(groovy.lang.ObjectRange range) |
java.lang.Object | getAt(java.util.Collection indices) |
void | putAt(int idx, java.lang.Boolean newValue) |
byte[]groovy.lang.Writable | encodeBase64() |
java.lang.Object | getAt(int idx) |
java.lang.Object | getAt(groovy.lang.Range range) |
java.lang.Object | getAt(groovy.lang.IntRange range) |
java.lang.Object | getAt(groovy.lang.ObjectRange range) |
java.lang.Object | getAt(java.util.Collection indices) |
void | putAt(int idx, java.lang.Object newValue) |
int | size() |
java.util.List | toList() |
char[]java.lang.Object | getAt(int idx) |
java.lang.Object | getAt(groovy.lang.Range range) |
java.lang.Object | getAt(groovy.lang.IntRange range) |
java.lang.Object | getAt(groovy.lang.ObjectRange range) |
java.lang.Object | getAt(java.util.Collection indices) |
void | putAt(int idx, java.lang.Object newValue) |
int | size() |
java.util.List | toList() |
doublevoid | downto(java.lang.Number to, groovy.lang.Closure closure) |
double[]java.lang.Object | getAt(int idx) |
java.lang.Object | getAt(groovy.lang.Range range) |
java.lang.Object | getAt(groovy.lang.IntRange range) |
java.lang.Object | getAt(groovy.lang.ObjectRange range) |
java.lang.Object | getAt(java.util.Collection indices) |
void | putAt(int idx, java.lang.Object newValue) |
int | size() |
java.util.List | toList() |
floatvoid | downto(java.lang.Number to, groovy.lang.Closure closure) |
void | upto(java.lang.Number to, groovy.lang.Closure closure) |
float[]java.lang.Object | getAt(int idx) |
java.lang.Object | getAt(groovy.lang.Range range) |
java.lang.Object | getAt(groovy.lang.IntRange range) |
java.lang.Object | getAt(groovy.lang.ObjectRange range) |
java.lang.Object | getAt(java.util.Collection indices) |
void | putAt(int idx, java.lang.Object newValue) |
int | size() |
java.util.List | toList() |
int[]java.lang.Object | getAt(int idx) |
java.lang.Object | getAt(groovy.lang.Range range) |
java.lang.Object | getAt(groovy.lang.IntRange range) |
java.lang.Object | getAt(groovy.lang.ObjectRange range) |
java.lang.Object | getAt(java.util.Collection indices) |
void | putAt(int idx, java.lang.Object newValue) |
int | size() |
java.util.List | toList() |
java.io.BufferedReaderjava.lang.String | getText() |
java.io.BufferedWritervoid | writeLine(java.lang.String line) |
java.io.Filevoid | append(java.lang.Object text) |
void | append(java.lang.Object text, java.lang.String charset) |
java.io.File | asWritable() |
java.io.File | asWritable(java.lang.String encoding) |
void | eachByte(groovy.lang.Closure closure) |
void | eachDir(groovy.lang.Closure closure) |
void | eachFile(groovy.lang.Closure closure) |
void | eachFileMatch(java.lang.Object filter, groovy.lang.Closure closure) |
void | eachFileRecurse(groovy.lang.Closure closure) |
void | eachLine(groovy.lang.Closure closure) |
void | eachObject(groovy.lang.Closure closure) |
groovy.lang.Writable | filterLine(groovy.lang.Closure closure) |
void | filterLine(java.io.Writer writer, groovy.lang.Closure closure) |
java.lang.String | getText(java.lang.String charset) |
java.lang.String | getText() |
java.io.File | leftShift(java.lang.Object text) |
java.io.BufferedInputStream | newInputStream() |
java.io.ObjectInputStream | newObjectInputStream() |
java.io.BufferedOutputStream | newOutputStream() |
java.io.PrintWriter | newPrintWriter() |
java.io.PrintWriter | newPrintWriter(java.lang.String charset) |
java.io.BufferedReader | newReader() |
java.io.BufferedReader | newReader(java.lang.String charset) |
java.io.BufferedWriter | newWriter() |
java.io.BufferedWriter | newWriter(boolean append) |
java.io.BufferedWriter | newWriter(java.lang.String charset, boolean append) |
java.io.BufferedWriter | newWriter(java.lang.String charset) |
byte[] | readBytes() |
java.util.List | readLines() |
long | size() |
void | splitEachLine(java.lang.String sep, groovy.lang.Closure closure) |
void | withInputStream(groovy.lang.Closure closure) |
void | withOutputStream(groovy.lang.Closure closure) |
void | withPrintWriter(groovy.lang.Closure closure) |
void | withReader(groovy.lang.Closure closure) |
void | withWriter(groovy.lang.Closure closure) |
void | withWriter(java.lang.String charset, groovy.lang.Closure closure) |
void | withWriterAppend(java.lang.String charset, groovy.lang.Closure closure) |
void | write(java.lang.String text) |
void | write(java.lang.String text, java.lang.String charset) |
java.io.InputStreamvoid | eachByte(groovy.lang.Closure closure) |
void | eachLine(groovy.lang.Closure closure) |
groovy.lang.Writable | filterLine(groovy.lang.Closure predicate) |
void | filterLine(java.io.Writer writer, groovy.lang.Closure predicate) |
java.lang.String | getText() |
java.lang.String | getText(java.lang.String charset) |
java.io.BufferedReader | newReader() |
java.lang.String | readLine() |
java.util.List | readLines() |
void | withReader(groovy.lang.Closure closure) |
void | withStream(groovy.lang.Closure closure) |
java.io.ObjectInputStreamvoid | eachObject(groovy.lang.Closure closure) |
java.io.OutputStreamjava.io.Writer | leftShift(java.lang.Object value) |
java.io.OutputStream | leftShift(java.io.InputStream in) |
java.io.OutputStream | leftShift(byte[] value) |
void | withStream(groovy.lang.Closure closure) |
void | withWriter(groovy.lang.Closure closure) |
void | withWriter(java.lang.String charset, groovy.lang.Closure closure) |
java.io.Readervoid | eachLine(groovy.lang.Closure closure) |
void | filterLine(java.io.Writer writer, groovy.lang.Closure closure) |
groovy.lang.Writable | filterLine(groovy.lang.Closure closure) |
java.lang.String | getText() |
java.lang.String | readLine() |
java.util.List | readLines() |
void | splitEachLine(java.lang.String sep, groovy.lang.Closure closure) |
void | transformChar(java.io.Writer writer, groovy.lang.Closure closure) |
void | transformLine(java.io.Writer writer, groovy.lang.Closure closure) |
void | withReader(groovy.lang.Closure closure) |
java.io.Writerjava.io.Writer | leftShift(java.lang.Object value) |
void | withWriter(groovy.lang.Closure closure) |
void | write(groovy.lang.Writable writable) |
java.lang.Booleanjava.lang.Boolean | and(java.lang.Boolean right) |
java.lang.Boolean | or(java.lang.Boolean right) |
java.lang.Boolean | xor(java.lang.Boolean right) |
java.lang.Byte[]groovy.lang.Writable | encodeBase64() |
java.lang.CharSequencejava.lang.CharSequence | getAt(int index) |
java.lang.CharSequence | getAt(groovy.lang.Range range) |
java.lang.CharSequence | getAt(groovy.lang.IntRange range) |
java.lang.CharSequence | getAt(java.util.Collection indices) |
java.lang.Characterint | compareTo(java.lang.Number right) |
int | compareTo(java.lang.Character right) |
java.lang.Number | div(java.lang.Number right) |
java.lang.Number | div(java.lang.Character right) |
java.lang.Number | intdiv(java.lang.Number right) |
java.lang.Number | intdiv(java.lang.Character right) |
java.lang.Number | minus(java.lang.Number right) |
java.lang.Number | minus(java.lang.Character right) |
java.lang.Number | multiply(java.lang.Number right) |
java.lang.Number | multiply(java.lang.Character right) |
java.lang.Number | next() |
java.lang.Number | plus(java.lang.Number right) |
java.lang.Number | plus(java.lang.Character right) |
java.lang.Number | previous() |
java.lang.Classboolean | isCase(java.lang.Object switchValue) |
java.lang.ClassLoaderjava.lang.ClassLoader | getRootLoader() |
java.lang.Doubledouble | abs() |
void | downto(java.lang.Number to, groovy.lang.Closure closure) |
long | round() |
void | upto(java.lang.Number to, groovy.lang.Closure closure) |
java.lang.Floatfloat | abs() |
void | downto(java.lang.Number to, groovy.lang.Closure closure) |
int | round() |
void | upto(java.lang.Number to, groovy.lang.Closure closure) |
java.lang.Longlong | abs() |
void | downto(java.lang.Number to, groovy.lang.Closure closure) |
void | upto(java.lang.Number to, groovy.lang.Closure closure) |
java.lang.Numberint | abs() |
java.lang.Number | and(java.lang.Number right) |
int | compareTo(java.lang.Character right) |
int | compareTo(java.lang.Number right) |
java.lang.Number | div(java.lang.Character right) |
java.lang.Number | div(java.lang.Number right) |
void | downto(java.lang.Number to, groovy.lang.Closure closure) |
java.lang.Number | intdiv(java.lang.Character right) |
java.lang.Number | intdiv(java.lang.Number right) |
java.lang.Number | leftShift(java.lang.Number right) |
java.lang.Number | minus(java.lang.Character right) |
java.lang.Number | minus(java.lang.Number right) |
java.lang.Number | mod(java.lang.Number right) |
java.lang.Number | multiply(java.lang.Character right) |
java.lang.Number | multiply(java.lang.Number right) |
java.lang.Number | negate() |
java.lang.Number | next() |
java.lang.Number | or(java.lang.Number right) |
java.lang.String | plus(java.lang.String right) |
java.lang.Number | plus(java.lang.Character right) |
java.lang.Number | plus(java.lang.Number right) |
java.lang.Number | power(java.lang.Number exponent) |
java.lang.Number | previous() |
java.lang.Number | rightShift(java.lang.Number right) |
java.lang.Number | rightShiftUnsigned(java.lang.Number right) |
void | step(java.lang.Number to, java.lang.Number stepNumber, groovy.lang.Closure closure) |
void | times(groovy.lang.Closure closure) |
java.math.BigDecimal | toBigDecimal() |
java.math.BigInteger | toBigInteger() |
java.lang.Double | toDouble() |
java.lang.Float | toFloat() |
java.lang.Integer | toInteger() |
java.lang.Long | toLong() |
void | upto(java.lang.Number to, groovy.lang.Closure closure) |
java.lang.Number | xor(java.lang.Number right) |
java.lang.Objectboolean | any(groovy.lang.Closure closure) |
java.util.List | collect(groovy.lang.Closure closure) |
java.util.Collection | collect(java.util.Collection collection, groovy.lang.Closure closure) |
java.lang.String | dump() |
void | each(groovy.lang.Closure closure) |
void | eachWithIndex(groovy.lang.Closure closure) |
boolean | every(groovy.lang.Closure closure) |
java.lang.Object | find(groovy.lang.Closure closure) |
java.util.List | findAll(groovy.lang.Closure closure) |
int | findIndexOf(groovy.lang.Closure closure) |
java.lang.Object | getAt(java.lang.String property) |
java.util.List | getMetaPropertyValues() |
java.util.Map | getProperties() |
java.util.List | grep(java.lang.Object filter) |
java.lang.Object | identity(groovy.lang.Closure closure) |
java.lang.String | inspect() |
java.lang.Object | invokeMethod(java.lang.String method, java.lang.Object arguments) |
boolean | is(java.lang.Object other) |
boolean | isCase(java.lang.Object switchValue) |
void | print(java.lang.Object value) |
void | print(java.io.PrintWriter out) |
void | printf(java.lang.String format, java.lang.Object[] values) |
void | printf(java.lang.String format, java.lang.Object arg) |
void | println() |
void | println(java.lang.Object value) |
void | println(java.io.PrintWriter out) |
void | putAt(java.lang.String property, java.lang.Object newValue) |
void | use(java.lang.Class categoryClass, groovy.lang.Closure closure) |
void | use(java.util.List categoryClassList, groovy.lang.Closure closure) |
void | use(java.lang.Object[] array) |
java.lang.Object[]java.util.List | getAt(java.util.Collection indices) |
java.util.List | getAt(groovy.lang.Range range) |
java.util.List | getAt(groovy.lang.IntRange range) |
java.util.List | getAt(groovy.lang.ObjectRange range) |
java.lang.Object | getAt(int idx) |
java.lang.Object | inject(java.lang.Object value, groovy.lang.Closure closure) |
java.lang.String | join(java.lang.String separator) |
void | putAt(int idx, java.lang.Object value) |
int | size() |
groovy.lang.SpreadList | spread() |
java.lang.String | toArrayString() |
java.util.List | toList() |
groovy.lang.SpreadList | toSpreadList() |
groovy.lang.SpreadMap | toSpreadMap() |
java.lang.String | toString() |
java.lang.Processvoid | consumeProcessOutput() |
java.io.InputStream | getErr() |
java.io.InputStream | getIn() |
java.io.OutputStream | getOut() |
java.lang.String | getText() |
java.io.Writer | leftShift(java.lang.Object value) |
java.io.OutputStream | leftShift(byte[] value) |
void | waitForOrKill(long numberOfMillis) |
java.lang.Stringjava.lang.String | center(java.lang.Number numberOfChars, java.lang.String padding) |
java.lang.String | center(java.lang.Number numberOfChars) |
boolean | contains(java.lang.String text) |
int | count(java.lang.String text) |
byte[] | decodeBase64() |
void | eachMatch(java.lang.String regex, groovy.lang.Closure closure) |
java.lang.Process | execute() |
java.lang.Process | execute(java.lang.String[] envp, java.io.File dir) |
java.lang.Process | execute(java.util.List envp, java.io.File dir) |
java.lang.String | getAt(int index) |
java.lang.String | getAt(groovy.lang.IntRange range) |
java.lang.String | getAt(groovy.lang.Range range) |
java.lang.String | getAt(java.util.Collection indices) |
boolean | isCase(java.lang.Object switchValue) |
java.lang.StringBuffer | leftShift(java.lang.Object value) |
java.lang.String | minus(java.lang.Object value) |
java.lang.String | multiply(java.lang.Number factor) |
java.util.regex.Pattern | negate() |
java.lang.String | next() |
java.lang.String | padLeft(java.lang.Number numberOfChars, java.lang.String padding) |
java.lang.String | padLeft(java.lang.Number numberOfChars) |
java.lang.String | padRight(java.lang.Number numberOfChars, java.lang.String padding) |
java.lang.String | padRight(java.lang.Number numberOfChars) |
java.lang.String | plus(java.lang.Object value) |
java.lang.String | previous() |
java.lang.String | replaceAll(java.lang.String regex, groovy.lang.Closure closure) |
java.lang.String | reverse() |
int | size() |
java.math.BigDecimal | toBigDecimal() |
java.math.BigInteger | toBigInteger() |
java.lang.Boolean | toBoolean() |
java.lang.Character | toCharacter() |
java.lang.Double | toDouble() |
java.lang.Float | toFloat() |
java.lang.Integer | toInteger() |
java.util.List | toList() |
java.lang.Long | toLong() |
java.net.URI | toURI() |
java.net.URL | toURL() |
java.util.List | tokenize(java.lang.String token) |
java.util.List | tokenize() |
java.lang.StringBufferjava.lang.StringBuffer | leftShift(java.lang.Object value) |
java.lang.String | plus(java.lang.String value) |
void | putAt(groovy.lang.IntRange range, java.lang.Object value) |
void | putAt(groovy.lang.EmptyRange range, java.lang.Object value) |
int | size() |
java.lang.String[]java.lang.Process | execute() |
java.math.BigDecimalvoid | downto(java.lang.Number to, groovy.lang.Closure closure) |
void | upto(java.lang.Number to, groovy.lang.Closure closure) |
java.math.BigIntegervoid | downto(java.lang.Number to, groovy.lang.Closure closure) |
void | upto(java.lang.Number to, groovy.lang.Closure closure) |
java.net.ServerSocketjava.net.Socket | accept(groovy.lang.Closure closure) |
java.net.Socketjava.io.Writer | leftShift(java.lang.Object value) |
java.io.OutputStream | leftShift(byte[] value) |
void | withStreams(groovy.lang.Closure closure) |
java.net.URLvoid | eachByte(groovy.lang.Closure closure) |
void | eachLine(groovy.lang.Closure closure) |
java.lang.String | getText() |
java.lang.String | getText(java.lang.String charset) |
void | withReader(groovy.lang.Closure closure) |
java.sql.Datejava.sql.Date | minus(int days) |
java.sql.Date | next() |
java.sql.Date | plus(int days) |
java.sql.Date | previous() |
java.util.Collectionjava.util.Collection | asImmutable() |
java.util.List | asList() |
java.util.Collection | asSynchronized() |
java.util.List | collect(groovy.lang.Closure closure) |
java.util.Collection | collect(java.util.Collection collection, groovy.lang.Closure closure) |
int | count(java.lang.Object value) |
boolean | disjoint(java.util.Collection right) |
void | each(groovy.lang.Closure closure) |
java.lang.Object | find(groovy.lang.Closure closure) |
java.util.List | findAll(groovy.lang.Closure closure) |
java.util.List | getAt(java.lang.String property) |
java.lang.Object | inject(java.lang.Object value, groovy.lang.Closure closure) |
boolean | isCase(java.lang.Object switchValue) |
java.lang.String | join(java.lang.String separator) |
java.util.Collection | leftShift(java.lang.Object value) |
java.lang.Object | max() |
java.lang.Object | max(org.codehaus.groovy.runtime.DefaultGroovyMethods$NumberComparator comparator) |
java.lang.Object | max(groovy.lang.Closure closure) |
java.lang.Object | min() |
java.lang.Object | min(org.codehaus.groovy.runtime.DefaultGroovyMethods$NumberComparator comparator) |
java.lang.Object | min(groovy.lang.Closure closure) |
java.util.List | multiply(java.lang.Number factor) |
java.util.List | plus(java.util.Collection right) |
java.util.List | plus(java.lang.Object right) |
java.util.List | sort() |
java.util.List | sort(org.codehaus.groovy.runtime.DefaultGroovyMethods$NumberComparator comparator) |
java.util.List | sort(groovy.lang.Closure closure) |
java.lang.Object | sum() |
java.lang.Object | sum(groovy.lang.Closure closure) |
java.util.List | toList() |
java.lang.String | toListString() |
java.lang.String | toString() |
java.util.Collection | unique() |
java.util.Collection | unique(org.codehaus.groovy.runtime.DefaultGroovyMethods$NumberComparator comparator) |
java.util.Datejava.util.Date | minus(int days) |
java.util.Date | next() |
java.util.Date | plus(int days) |
java.util.Date | previous() |
java.util.Listjava.util.List | asImmutable() |
java.util.List | asSynchronized() |
boolean | equals(java.util.List right) |
java.lang.Process | execute() |
java.util.List | flatten() |
java.util.List | getAt(groovy.lang.IntRange range) |
java.util.List | getAt(java.util.Collection indices) |
java.lang.Object | getAt(int idx) |
java.util.List | intersect(java.util.Collection right) |
java.util.List | minus(java.util.Collection removeMe) |
java.lang.Object | pop() |
void | putAt(int idx, java.lang.Object value) |
void | putAt(groovy.lang.EmptyRange range, java.lang.Object value) |
void | putAt(groovy.lang.IntRange range, java.lang.Object value) |
void | putAt(java.util.List splice, java.util.List values) |
void | putAt(java.util.List splice, java.lang.Object value) |
java.util.List | reverse() |
void | reverseEach(groovy.lang.Closure closure) |
java.util.List | sort() |
java.util.List | sort(org.codehaus.groovy.runtime.DefaultGroovyMethods$NumberComparator comparator) |
java.util.List | sort(groovy.lang.Closure closure) |
groovy.lang.SpreadList | spread() |
groovy.lang.SpreadList | toSpreadList() |
java.util.Mapjava.util.Map | asImmutable() |
java.util.Map | asSynchronized() |
java.util.Collection | collect(java.util.Collection collection, groovy.lang.Closure closure) |
java.util.List | collect(groovy.lang.Closure closure) |
void | each(groovy.lang.Closure closure) |
java.lang.Object | find(groovy.lang.Closure closure) |
java.util.Map | findAll(groovy.lang.Closure closure) |
java.lang.Object | get(java.lang.Object key, java.lang.Object defaultValue) |
java.lang.Object | getAt(java.lang.Object key) |
java.lang.Object | putAt(java.lang.Object key, java.lang.Object value) |
groovy.lang.SpreadMap | spread() |
java.util.Map | subMap(java.util.Collection keys) |
java.lang.String | toMapString() |
groovy.lang.SpreadMap | toSpreadMap() |
java.lang.String | toString() |
java.util.Setjava.util.Set | asImmutable() |
java.util.Set | asSynchronized() |
java.util.SortedMapjava.util.SortedMap | asImmutable() |
java.util.SortedMap | asSynchronized() |
java.util.SortedSetjava.util.SortedSet | asImmutable() |
java.util.SortedSet | asSynchronized() |
java.util.SortedSet | sort() |
java.util.Timervoid | runAfter(int delay, groovy.lang.Closure closure) |
java.util.regex.Matchervoid | each(groovy.lang.Closure closure) |
java.lang.Object | getAt(int idx) |
java.lang.String | getAt(java.util.Collection indices) |
int | getCount() |
boolean | hasGroup() |
void | setIndex(int idx) |
long | size() |
java.util.regex.Patternboolean | isCase(java.lang.Object switchValue) |
longvoid | downto(java.lang.Number to, groovy.lang.Closure closure) |
void | upto(java.lang.Number to, groovy.lang.Closure closure) |
long[]java.lang.Object | getAt(int idx) |
java.lang.Object | getAt(groovy.lang.Range range) |
java.lang.Object | getAt(groovy.lang.IntRange range) |
java.lang.Object | getAt(groovy.lang.ObjectRange range) |
java.lang.Object | getAt(java.util.Collection indices) |
void | putAt(int idx, java.lang.Object newValue) |
int | size() |
java.util.List | toList() |
short[]java.lang.Object | getAt(int idx) |
java.lang.Object | getAt(groovy.lang.Range range) |
java.lang.Object | getAt(groovy.lang.IntRange range) |
java.lang.Object | getAt(groovy.lang.ObjectRange range) |
java.lang.Object | getAt(java.util.Collection indices) |
void | putAt(int idx, java.lang.Object newValue) |
int | size() |
java.util.List | toList() |
boolean[]
java.lang.Object getAt(int idx)
- returns: java.lang.Object
java.lang.Object getAt(groovy.lang.Range range)
- returns: java.lang.Object
java.lang.Object getAt(groovy.lang.IntRange range)
- returns: java.lang.Object
java.lang.Object getAt(groovy.lang.ObjectRange range)
- returns: java.lang.Object
java.lang.Object getAt(java.util.Collection indices)
- returns: java.lang.Object
void putAt(int idx, java.lang.Boolean newValue)
byte[]
groovy.lang.Writable encodeBase64()
Produce a Writable object which writes the base64 encoding of the byte array Calling toString() on the result rerurns the encoding as a String - returns: groovy.lang.Writable - object which will write the base64 encoding of the byte array
java.lang.Object getAt(int idx)
- returns: java.lang.Object
java.lang.Object getAt(groovy.lang.Range range)
- returns: java.lang.Object
java.lang.Object getAt(groovy.lang.IntRange range)
- returns: java.lang.Object
java.lang.Object getAt(groovy.lang.ObjectRange range)
- returns: java.lang.Object
java.lang.Object getAt(java.util.Collection indices)
- returns: java.lang.Object
void putAt(int idx, java.lang.Object newValue)
int size()
java.util.List toList()
char[]
java.lang.Object getAt(int idx)
- returns: java.lang.Object
java.lang.Object getAt(groovy.lang.Range range)
- returns: java.lang.Object
java.lang.Object getAt(groovy.lang.IntRange range)
- returns: java.lang.Object
java.lang.Object getAt(groovy.lang.ObjectRange range)
- returns: java.lang.Object
java.lang.Object getAt(java.util.Collection indices)
- returns: java.lang.Object
void putAt(int idx, java.lang.Object newValue)
int size()
java.util.List toList()
double
void downto(java.lang.Number to, groovy.lang.Closure closure)
double[]
java.lang.Object getAt(int idx)
- returns: java.lang.Object
java.lang.Object getAt(groovy.lang.Range range)
- returns: java.lang.Object
java.lang.Object getAt(groovy.lang.IntRange range)
- returns: java.lang.Object
java.lang.Object getAt(groovy.lang.ObjectRange range)
- returns: java.lang.Object
java.lang.Object getAt(java.util.Collection indices)
- returns: java.lang.Object
void putAt(int idx, java.lang.Object newValue)
int size()
java.util.List toList()
float
void downto(java.lang.Number to, groovy.lang.Closure closure)
void upto(java.lang.Number to, groovy.lang.Closure closure)
float[]
java.lang.Object getAt(int idx)
- returns: java.lang.Object
java.lang.Object getAt(groovy.lang.Range range)
- returns: java.lang.Object
java.lang.Object getAt(groovy.lang.IntRange range)
- returns: java.lang.Object
java.lang.Object getAt(groovy.lang.ObjectRange range)
- returns: java.lang.Object
java.lang.Object getAt(java.util.Collection indices)
- returns: java.lang.Object
void putAt(int idx, java.lang.Object newValue)
int size()
java.util.List toList()
int[]
java.lang.Object getAt(int idx)
- returns: java.lang.Object
java.lang.Object getAt(groovy.lang.Range range)
- returns: java.lang.Object
java.lang.Object getAt(groovy.lang.IntRange range)
- returns: java.lang.Object
java.lang.Object getAt(groovy.lang.ObjectRange range)
- returns: java.lang.Object
java.lang.Object getAt(java.util.Collection indices)
- returns: java.lang.Object
void putAt(int idx, java.lang.Object newValue)
int size()
java.util.List toList()
java.io.BufferedReader
java.lang.String getText()
Reads the content of the BufferedReader and returns it as a String - returns: java.lang.String - a String containing the content of the buffered reader
- throws: java.io.IOException - IOException
java.io.BufferedWriter
void writeLine(java.lang.String line)
Write the text and append a new line (depending on the platform line-ending) - param line the line to write
- throws: java.io.IOException - IOException
java.io.File
void append(java.lang.Object text)
Append the text at the end of the File - param text the text to append at the end of the File
- throws: java.io.IOException - IOException
void append(java.lang.Object text, java.lang.String charset)
Append the text at the end of the File with a specified encoding - param text the text to append at the end of the File
- param charset the charset used
- throws: java.io.IOException - IOException
java.io.File asWritable()
- returns: java.io.File - a File which wraps the input file and which implements Writable
java.io.File asWritable(java.lang.String encoding)
- param encoding the encoding to be used when reading the file's contents
- returns: java.io.File - File which wraps the input file and which implements Writable
void eachByte(groovy.lang.Closure closure)
Traverse through each byte of the specified File - param closure a closure
- throws: java.io.IOException
void eachDir(groovy.lang.Closure closure)
Invokes the closure for each directory in the given directory, ignoring regular files. - param closure a closure
- throws: java.io.FileNotFoundException - FileNotFoundException Thrown if the given directory does not exist
- throws: java.lang.IllegalArgumentException - FileNotFoundException Thrown if the given directory does not exist
void eachFile(groovy.lang.Closure closure)
Invokes the closure for each file in the given directory - param closure a closure
- throws: java.io.FileNotFoundException - FileNotFoundException Thrown if the given directory does not exist
- throws: java.lang.IllegalArgumentException - FileNotFoundException Thrown if the given directory does not exist
void eachFileMatch(java.lang.Object filter, groovy.lang.Closure closure)
Invokes the closure for each file matching the given filter in the given directory - calling the isCase() method used by switch statements. This method can be used with different kinds of filters like regular expresions, classes, ranges etc. - param filter the filter to perform on the directory (using the isCase(object) method)
- param closure
- throws: java.io.FileNotFoundException - FileNotFoundException Thrown if the given directory does not exist
- throws: java.lang.IllegalArgumentException - FileNotFoundException Thrown if the given directory does not exist
void eachFileRecurse(groovy.lang.Closure closure)
Invokes the closure for each file in the given directory and recursively. It is a depth-first exploration, directories are included in the search. - param closure a closure
- throws: java.io.FileNotFoundException - FileNotFoundException Thrown if the given directory does not exist
- throws: java.lang.IllegalArgumentException - FileNotFoundException Thrown if the given directory does not exist
void eachLine(groovy.lang.Closure closure)
Iterates through the given file line by line - param closure a closure
- throws: java.io.IOException - IOException
void eachObject(groovy.lang.Closure closure)
Iterates through the given file object by object - param closure a closure
- throws: java.io.IOException - IOException
- throws: java.lang.ClassNotFoundException - IOException
groovy.lang.Writable filterLine(groovy.lang.Closure closure)
Filters the lines of a File and creates a Writeable in return to stream the filtered lines - param closure a closure which returns a boolean indicating to filter the line or not
- returns: groovy.lang.Writable - a Writable closure
- throws: java.io.IOException - IOException if <code>self</code> is not readable
void filterLine(java.io.Writer writer, groovy.lang.Closure closure)
Filter the lines from a File and write them on a writer, according to a closure which returns true or false - param writer a writer
- param closure a closure which returns a boolean value and takes a line as input
- throws: java.io.IOException - IOException if <code>self</code> is not readable
java.lang.String getText(java.lang.String charset)
Reads the content of the File opened with the specified encoding and returns it as a String - param charset the charset used to read the content of the file
- returns: java.lang.String - a String containing the content of the file
- throws: java.io.IOException - IOException
java.lang.String getText()
Reads the content of the File and returns it as a String - returns: java.lang.String - a String containing the content of the file
- throws: java.io.IOException - IOException
java.io.File leftShift(java.lang.Object text)
Write the text to the File. - param text the text to write to the File
- returns: java.io.File
- throws: java.io.IOException - IOException
java.io.BufferedInputStream newInputStream()
Helper method to create a buffered input stream for a file - returns: java.io.BufferedInputStream - a BufferedInputStream of the file
- throws: java.io.FileNotFoundException - FileNotFoundException
java.io.ObjectInputStream newObjectInputStream()
Helper method to create an object input stream from the given file. - returns: java.io.ObjectInputStream - an object input stream
- throws: java.io.FileNotFoundException - FileNotFoundException
- throws: java.io.IOException - FileNotFoundException
java.io.BufferedOutputStream newOutputStream()
Helper method to create a buffered output stream for a file - returns: java.io.BufferedOutputStream
- throws: java.io.IOException - FileNotFoundException
java.io.PrintWriter newPrintWriter()
Helper method to create a new PrintWriter for a file - returns: java.io.PrintWriter
- throws: java.io.IOException - FileNotFoundException
java.io.PrintWriter newPrintWriter(java.lang.String charset)
Helper method to create a new PrintWriter for a file with a specified charset - param charset the charset
- returns: java.io.PrintWriter - a PrintWriter
- throws: java.io.IOException - FileNotFoundException
java.io.BufferedReader newReader()
Helper method to create a buffered reader for a file - returns: java.io.BufferedReader - a BufferedReader
- throws: java.io.IOException - IOException
java.io.BufferedReader newReader(java.lang.String charset)
Helper method to create a buffered reader for a file, with a specified charset - param charset the charset with which we want to write in the File
- returns: java.io.BufferedReader - a BufferedReader
- throws: java.io.FileNotFoundException - FileNotFoundException if the File was not found
- throws: java.io.UnsupportedEncodingException - FileNotFoundException if the File was not found
java.io.BufferedWriter newWriter()
Helper method to create a buffered writer for a file - returns: java.io.BufferedWriter - a BufferedWriter
- throws: java.io.IOException - FileNotFoundException
java.io.BufferedWriter newWriter(boolean append)
Helper method to create a buffered writer for a file in append mode - param append true if in append mode
- returns: java.io.BufferedWriter - a BufferedWriter
- throws: java.io.IOException - FileNotFoundException
java.io.BufferedWriter newWriter(java.lang.String charset, boolean append)
Helper method to create a buffered writer for a file - param charset the name of the encoding used to write in this file
- param append true if in append mode
- returns: java.io.BufferedWriter - a BufferedWriter
- throws: java.io.IOException - FileNotFoundException
java.io.BufferedWriter newWriter(java.lang.String charset)
Helper method to create a buffered writer for a file - param charset the name of the encoding used to write in this file
- returns: java.io.BufferedWriter - a BufferedWriter
- throws: java.io.IOException - FileNotFoundException
byte[] readBytes()
Reads the content of the file into an array of byte - returns: byte[] - a List of Bytes
- throws: java.io.IOException
java.util.List readLines()
Reads the file into a list of Strings for each line - returns: java.util.List - a List of lines
- throws: java.io.IOException - IOException
long size()
Provide the standard Groovy size method
void splitEachLine(java.lang.String sep, groovy.lang.Closure closure)
Iterates through the given file line by line, splitting on the seperator - param sep a String separator
- param closure a closure
- throws: java.io.IOException - IOException
void withInputStream(groovy.lang.Closure closure)
Helper method to create a new InputStream for a file and then passes it into the closure and ensures its closed again afterwords - throws: java.io.IOException - FileNotFoundException
void withOutputStream(groovy.lang.Closure closure)
Helper method to create a new OutputStream for a file and then passes it into the closure and ensures its closed again afterwords - throws: java.io.IOException - FileNotFoundException
void withPrintWriter(groovy.lang.Closure closure)
Helper method to create a new PrintWriter for a file and then passes it into the closure and ensures its closed again afterwords - throws: java.io.IOException - FileNotFoundException
void withReader(groovy.lang.Closure closure)
Helper method to create a new BufferedReader for a file and then passes it into the closure and ensures its closed again afterwords - throws: java.io.IOException - FileNotFoundException
void withWriter(groovy.lang.Closure closure)
Helper method to create a new BufferedWriter for a file and then passes it into the closure and ensures it is closed again afterwords - param closure a closure
- throws: java.io.IOException - FileNotFoundException
void withWriter(java.lang.String charset, groovy.lang.Closure closure)
Helper method to create a new BufferedWriter for a file in a specified encoding and then passes it into the closure and ensures it is closed again afterwords - param charset the charset used
- param closure a closure
- throws: java.io.IOException - FileNotFoundException
void withWriterAppend(java.lang.String charset, groovy.lang.Closure closure)
Helper method to create a new BufferedWriter for a file in a specified encoding in append mode and then passes it into the closure and ensures it is closed again afterwords - param charset the charset used
- param closure a closure
- throws: java.io.IOException - FileNotFoundException
void write(java.lang.String text)
Write the text to the File. - param text the text to write to the File
- throws: java.io.IOException - IOException
void write(java.lang.String text, java.lang.String charset)
Write the text to the File with a specified encoding. - param text the text to write to the File
- param charset the charset used
- throws: java.io.IOException - IOException
java.io.InputStream
void eachByte(groovy.lang.Closure closure)
Traverse through each byte of the specified stream - param closure closure to apply to each byte
- throws: java.io.IOException - IOException
void eachLine(groovy.lang.Closure closure)
Iterates through the given stream line by line - param closure a closure
- throws: java.io.IOException - IOException
groovy.lang.Writable filterLine(groovy.lang.Closure predicate)
Filter lines from an input stream using a closure predicate - param predicate a closure which returns boolean and takes a line
- returns: groovy.lang.Writable - a filtered writer
void filterLine(java.io.Writer writer, groovy.lang.Closure predicate)
Filters lines from an input stream, writing to a writer, using a closure which returns boolean and takes a line. - param writer a writer to write output to
- param predicate a closure which returns a boolean and takes a line as input
- throws: java.io.IOException
java.lang.String getText()
Reads the content of this InputStream and returns it as a String - returns: java.lang.String - the text from that URL
- throws: java.io.IOException - IOException
java.lang.String getText(java.lang.String charset)
Reads the content of this InputStream with a specified charset and returns it as a String - param charset opens the stream with a specified charset
- returns: java.lang.String - the text from that URL
- throws: java.io.IOException - IOException
java.io.BufferedReader newReader()
Provides a reader for an arbitrary input stream - returns: java.io.BufferedReader - a reader
java.lang.String readLine()
Read a single, whole line from the given InputStream - returns: java.lang.String - a line
- throws: java.io.IOException - IOException
java.util.List readLines()
Reads the stream into a list of Strings for each line - returns: java.util.List - a List of lines
- throws: java.io.IOException - IOException
void withReader(groovy.lang.Closure closure)
Helper method to create a new BufferedReader for a stream and then passes it into the closure and ensures its closed again afterwords - throws: java.io.IOException - FileNotFoundException
void withStream(groovy.lang.Closure closure)
Allows a InputStream to be used, calling the closure with the stream and then ensuring that the stream is closed down again irrespective of whether exceptions occur or the - param closure the closure that the stream is passed into
- throws: java.io.IOException - IOException
java.io.ObjectInputStream
void eachObject(groovy.lang.Closure closure)
Iterates through the given object stream object by object - param closure a closure
- throws: java.io.IOException - IOException
- throws: java.lang.ClassNotFoundException - IOException
java.io.OutputStream
java.io.Writer leftShift(java.lang.Object value)
Overloads the left shift operator to provide an append mechanism to add things to a stream - param value a value to append
- returns: java.io.Writer - a Writer
- throws: java.io.IOException
java.io.OutputStream leftShift(java.io.InputStream in)
Pipe an inputstream into an outputstream for efficient stream copying. - param in stream to read from
- returns: java.io.OutputStream - the outputstream itself
- throws: java.io.IOException - IOException
java.io.OutputStream leftShift(byte[] value)
Overloads the left shift operator to provide an append mechanism to add bytes to a stream - param value a value to append
- returns: java.io.OutputStream - an OutputStream
- throws: java.io.IOException
void withStream(groovy.lang.Closure closure)
Allows a OutputStream to be used, calling the closure with the stream and then ensuring that the stream is closed down again irrespective of whether exceptions occur. - param closure the closure that the stream is passed into
- throws: java.io.IOException - IOException
void withWriter(groovy.lang.Closure closure)
Allows an output stream to be used, calling the closure with the output stream and then ensuring that the output stream is closed down again irrespective of whether exceptions occur - param closure the closure that the writer is passed into
- throws: java.io.IOException - IOException
void withWriter(java.lang.String charset, groovy.lang.Closure closure)
Allows an output stream to be used, calling the closure with the output stream and then ensuring that the output stream is closed down again irrespective of whether exceptions occur. - param charset the charset used
- param closure the closure that the writer is passed into
- throws: java.io.IOException - IOException
java.io.Reader
void eachLine(groovy.lang.Closure closure)
Iterates through the given reader line by line - param closure a closure
- throws: java.io.IOException - IOException
void filterLine(java.io.Writer writer, groovy.lang.Closure closure)
Filter the lines from a reader and write them on the writer, according to a closure which returns true or false. - param writer a writer
- param closure the closure which returns booleans
- throws: java.io.IOException - IOException
groovy.lang.Writable filterLine(groovy.lang.Closure closure)
Filter the lines of a Reader and create a Writable in return to stream the filtered lines - param closure a closure returning a boolean indicating to filter or not a line
- returns: groovy.lang.Writable - a Writable closure
java.lang.String getText()
Reads the content of the Reader and returns it as a String - returns: java.lang.String - a String containing the content of the buffered reader
- throws: java.io.IOException - IOException
java.lang.String readLine()
Read a single, whole line from the given Reader - returns: java.lang.String - a line
- throws: java.io.IOException - IOException
java.util.List readLines()
Reads the reader into a list of Strings for each line - returns: java.util.List - a List of lines
- throws: java.io.IOException - IOException
void splitEachLine(java.lang.String sep, groovy.lang.Closure closure)
Iterates through the given reader line by line, splitting on the seperator - param sep a String separator
- param closure a closure
- throws: java.io.IOException - IOException
void transformChar(java.io.Writer writer, groovy.lang.Closure closure)
Transforms the characters from a reader with a Closure and write them to a writer - param writer
- param closure
void transformLine(java.io.Writer writer, groovy.lang.Closure closure)
Transforms the lines from a reader with a Closure and write them to a writer - param writer Where transformed lines are written.
- param closure Single parameter closure that is called to transform each line of text from the reader, before writing it to the writer.
- throws: java.io.IOException
void withReader(groovy.lang.Closure closure)
Allows a Reader to be used, calling the closure with the writer and then ensuring that the writer is closed down again irrespective of whether exceptions occur or the - param closure the closure that the writer is passed into
- throws: java.io.IOException - IOException
java.io.Writer
java.io.Writer leftShift(java.lang.Object value)
Overloads the left shift operator to provide an append mechanism to add things to a writer - param value a value to append
- returns: java.io.Writer - a StringWriter
- throws: java.io.IOException
void withWriter(groovy.lang.Closure closure)
Allows a writer to be used, calling the closure with the writer and then ensuring that the writer is closed down again irrespective of whether exceptions occur or the - param closure the closure that the writer is passed into
- throws: java.io.IOException - IOException
void write(groovy.lang.Writable writable)
A helper method so that dynamic dispatch of the writer.write(object) method will always use the more efficient Writable.writeTo(writer) mechanism if the object implements the Writable interface. - param writable an object implementing the Writable interface
- throws: java.io.IOException
java.lang.Boolean
java.lang.Boolean and(java.lang.Boolean right)
- returns: java.lang.Boolean
java.lang.Boolean or(java.lang.Boolean right)
- returns: java.lang.Boolean
java.lang.Boolean xor(java.lang.Boolean right)
- returns: java.lang.Boolean
java.lang.Byte[]
groovy.lang.Writable encodeBase64()
- returns: groovy.lang.Writable
java.lang.CharSequence
java.lang.CharSequence getAt(int index)
Support the subscript operator for String. - param index the index of the Character to get
- returns: java.lang.CharSequence - the Character at the given index
java.lang.CharSequence getAt(groovy.lang.Range range)
Support the range subscript operator for CharSequence - param range a Range
- returns: java.lang.CharSequence - the subsequence CharSequence
java.lang.CharSequence getAt(groovy.lang.IntRange range)
Support the range subscript operator for CharSequence or StringBuffer with IntRange - param range an IntRange
- returns: java.lang.CharSequence - the subsequence CharSequence
java.lang.CharSequence getAt(java.util.Collection indices)
Allows a List to be used as the indices to be used on a CharSequence - param indices a Collection of indices
- returns: java.lang.CharSequence - a String of the values at the given indices
java.lang.Character
int compareTo(java.lang.Number right)
Compare a Character and a Number - param right a Number
- returns: int - the result of the comparison
int compareTo(java.lang.Character right)
Compare two Characters - param right a Character
- returns: int - the result of the comparison
java.lang.Number div(java.lang.Number right)
Divide a Character by a Number - param right a Number
- returns: java.lang.Number - the multiplication of both
java.lang.Number div(java.lang.Character right)
Divide two Characters - param right another Character
- returns: java.lang.Number - the multiplication of both
java.lang.Number intdiv(java.lang.Number right)
Integer Divide a Character by a Number - param right a Number
- returns: java.lang.Number - the integer division of both
java.lang.Number intdiv(java.lang.Character right)
Integer Divide two Characters - param right another Character
- returns: java.lang.Number - the integer division of both
java.lang.Number minus(java.lang.Number right)
Subtract a Number from a Character - param right a Number
- returns: java.lang.Number - the addition of the Character and the Number
java.lang.Number minus(java.lang.Character right)
Subtraction two Characters - param right a Character
- returns: java.lang.Number - the addition of both Characters
java.lang.Number multiply(java.lang.Number right)
Multiply a Character by a Number - param right a Number
- returns: java.lang.Number - the multiplication of both
java.lang.Number multiply(java.lang.Character right)
Multiply two Characters - param right another Character
- returns: java.lang.Number - the multiplication of both
java.lang.Number next()
Increment a Character by one - returns: java.lang.Number - an incremented Number
java.lang.Number plus(java.lang.Number right)
Add a Character and a Number - param right a Number
- returns: java.lang.Number - the addition of the Character and the Number
java.lang.Number plus(java.lang.Character right)
Add two Characters - param right a Character
- returns: java.lang.Number - the addition of both Characters
java.lang.Number previous()
Decrement a Character by one - returns: java.lang.Number - a decremented Number
java.lang.Class
boolean isCase(java.lang.Object switchValue)
java.lang.ClassLoader
java.lang.ClassLoader getRootLoader()
Iterates through the class loader parents until it finds a loader with a class named equal to org.codehaus.groovy.tools.RootLoader. If there is no such class null will be returned. The name has to be used because a direct compare with == may fail as the class may be loaded through different classloaders. - returns: java.lang.ClassLoader
java.lang.Double
double abs()
Get the absolute value - returns: double - the absolute value of that Double
void downto(java.lang.Number to, groovy.lang.Closure closure)
long round()
Round the value - returns: long - the absolute value of that Double
void upto(java.lang.Number to, groovy.lang.Closure closure)
java.lang.Float
float abs()
Get the absolute value - returns: float - the absolute value of that Float
void downto(java.lang.Number to, groovy.lang.Closure closure)
int round()
Get the absolute value - returns: int - the absolute value of that Float
void upto(java.lang.Number to, groovy.lang.Closure closure)
java.lang.Long
long abs()
Get the absolute value - returns: long - the absolute value of that Long
void downto(java.lang.Number to, groovy.lang.Closure closure)
void upto(java.lang.Number to, groovy.lang.Closure closure)
java.lang.Number
int abs()
Get the absolute value - returns: int - the absolute value of that Number
java.lang.Number and(java.lang.Number right)
Bitwise AND together two Numbers - param right another Number to bitwse AND
- returns: java.lang.Number - the bitwise AND of both Numbers
int compareTo(java.lang.Character right)
Compare a Number and a Character - param right a Character
- returns: int - the result of the comparison
int compareTo(java.lang.Number right)
Compare two Numbers - param right another Number to compare to
- returns: int - the comparision of both numbers
java.lang.Number div(java.lang.Character right)
Divide a Number by a Character - param right a Character
- returns: java.lang.Number - the multiplication of both
java.lang.Number div(java.lang.Number right)
Divide two Numbers - param right another Number
- returns: java.lang.Number - a Number resulting of the divide operation
void downto(java.lang.Number to, groovy.lang.Closure closure)
Iterates from this number down to the given number - param to another Number to go down to
- param closure the closure to call
java.lang.Number intdiv(java.lang.Character right)
Integer Divide a Number by a Character - param right a Character
- returns: java.lang.Number - the integer division of both
java.lang.Number intdiv(java.lang.Number right)
Integer Divide two Numbers - param right another Number
- returns: java.lang.Number - a Number (an Integer) resulting of the integer division operation
java.lang.Number leftShift(java.lang.Number right)
Implementation of the left shift operator for integral types. Non integral Number types throw UnsupportedOperationException. - returns: java.lang.Number
java.lang.Number minus(java.lang.Character right)
Subtract a Character from a Number - param right a Character
- returns: java.lang.Number - the addition of the Character and the Number
java.lang.Number minus(java.lang.Number right)
Substraction of two Numbers - param right another Number to substract to the first one
- returns: java.lang.Number - the substraction
java.lang.Number mod(java.lang.Number right)
Performs a division modulus operation - param right another Number to mod
- returns: java.lang.Number - the modulus result
java.lang.Number multiply(java.lang.Character right)
Multiply a Number by a Character - param right a Character
- returns: java.lang.Number - the multiplication of both
java.lang.Number multiply(java.lang.Number right)
Multiply two Numbers - param right another Number
- returns: java.lang.Number - the multiplication of both
java.lang.Number negate()
Negates the number - returns: java.lang.Number - the negation of the number
java.lang.Number next()
Increment a Number by one - returns: java.lang.Number - an incremented Number
java.lang.Number or(java.lang.Number right)
Bitwise OR together two numbers - param right another Number to bitwise OR
- returns: java.lang.Number - the bitwise OR of both Numbers
java.lang.String plus(java.lang.String right)
Appends a String - param right a String
- returns: java.lang.String - a String
java.lang.Number plus(java.lang.Character right)
Add a Number and a Character - param right a Character
- returns: java.lang.Number - the addition of the Character and the Number
java.lang.Number plus(java.lang.Number right)
Add two numbers and return the result. - param right another Number to add
- returns: java.lang.Number - the addition of both Numbers
java.lang.Number power(java.lang.Number exponent)
Power of a Number to a certain exponent - param exponent a Number exponent
- returns: java.lang.Number - a Number to the power of a certain exponent
java.lang.Number previous()
Decrement a Number by one - returns: java.lang.Number - a decremented Number
java.lang.Number rightShift(java.lang.Number right)
Implementation of the right shift operator for integral types. Non integral Number types throw UnsupportedOperationException. - returns: java.lang.Number
java.lang.Number rightShiftUnsigned(java.lang.Number right)
Implementation of the right shift (unsigned) operator for integral types. Non integral Number types throw UnsupportedOperationException. - returns: java.lang.Number
void step(java.lang.Number to, java.lang.Number stepNumber, groovy.lang.Closure closure)
Iterates from this number up to the given number using a step increment - param to a Number to go up to
- param stepNumber a Number representing the step increment
- param closure the closure to call
void times(groovy.lang.Closure closure)
Iterates a number of times - param closure the closure to call a number of times
java.math.BigDecimal toBigDecimal()
Transform a Number into a BigDecimal - returns: java.math.BigDecimal - an BigDecimal
java.math.BigInteger toBigInteger()
Transform a Number into a BigInteger - returns: java.math.BigInteger - an BigInteger
java.lang.Double toDouble()
Transform a Number into a Double - returns: java.lang.Double - an Double
java.lang.Float toFloat()
Transform a Number into a Float - returns: java.lang.Float - an Float
java.lang.Integer toInteger()
Transform a Number into an Integer - returns: java.lang.Integer - an Integer
java.lang.Long toLong()
Transform a Number into a Long - returns: java.lang.Long - an Long
void upto(java.lang.Number to, groovy.lang.Closure closure)
Iterates from this number up to the given number - param to another Number to go up to
- param closure the closure to call
java.lang.Number xor(java.lang.Number right)
Bitwise XOR together two Numbers - param right another Number to bitwse XOR
- returns: java.lang.Number - the bitwise XOR of both Numbers
java.lang.Object
boolean any(groovy.lang.Closure closure)
Iterates over every element of a collection, and check whether a predicate is valid for at least one element - param closure the closure predicate used for matching
- returns: boolean - true if any item in the collection matches the closure predicate
java.util.List collect(groovy.lang.Closure closure)
Iterates through this object transforming each object into a new value using the closure as a transformer, returning a list of transformed values. - param closure the closure used to map each element of the collection
- returns: java.util.List - a List of the mapped values
java.util.Collection collect(java.util.Collection collection, groovy.lang.Closure closure)
Iterates through this object transforming each object into a new value using the closure as a transformer and adding it to the collection, returning the resulting collection. - param collection the Collection to which the mapped values are added
- param closure the closure used to map each element of the collection
- returns: java.util.Collection - the resultant collection
java.lang.String dump()
Generates a detailed dump string of an object showing its class, hashCode and fields - returns: java.lang.String
void each(groovy.lang.Closure closure)
Allows objects to be iterated through using a closure - param closure the closure applied on each element found
void eachWithIndex(groovy.lang.Closure closure)
Allows object to be iterated through a closure with a counter
boolean every(groovy.lang.Closure closure)
Iterates over every element of a collection, and check whether a predicate is valid for all elements. - param closure the closure predicate used for matching
- returns: boolean - true if every item in the collection matches the closure predicate
java.lang.Object find(groovy.lang.Closure closure)
Finds the first value matching the closure condition - param closure a closure condition
- returns: java.lang.Object - the first Object found
java.util.List findAll(groovy.lang.Closure closure)
Finds all values matching the closure condition - param closure a closure condition
- returns: java.util.List - a List of the values found
int findIndexOf(groovy.lang.Closure closure)
Iterates over every element of the collection and return the index of the first object that matches the condition specified in the closure - param closure the filter to perform a match on the collection
- returns: int - an integer that is the index of the first macthed object.
java.lang.Object getAt(java.lang.String property)
Allows the subscript operator to be used to lookup dynamic property values. bean[somePropertyNameExpression]
. The normal property notation of groovy is neater and more concise but only works with compile time known property names. - returns: java.lang.Object
java.util.List getMetaPropertyValues()
Retrieves the list of {@link MetaProperty} objects for 'self' and wraps it in a list of {@link PropertyValue} objects that additionally provide the value for each property of 'self'. - see groovy.util.Expando#getMetaPropertyValues()
- returns: java.util.List - list of {@link PropertyValue} objects
java.util.Map getProperties()
Convenience method that calls {@link #getMetaPropertyValues(Object)}(self) and provides the data in form of simple key/value pairs, i.e. without type() information. - returns: java.util.Map - meta properties as Map of key/value pairs
java.util.List grep(java.lang.Object filter)
Iterates over every element of the collection and return each object that matches the given filter - calling the isCase() method used by switch statements. This method can be used with different kinds of filters like regular expresions, classes, ranges etc. - param filter the filter to perform on the collection (using the isCase(object) method)
- returns: java.util.List - a list of objects which match the filter
java.lang.Object identity(groovy.lang.Closure closure)
Allows the closure to be called for the object reference self - param closure the closure to call on the object
- returns: java.lang.Object - result of calling the closure
java.lang.String inspect()
- returns: java.lang.String - a String that matches what would be typed into a terminal to create this object. e.g. [1, 'hello'].inspect() -> [1, "hello"]
java.lang.Object invokeMethod(java.lang.String method, java.lang.Object arguments)
Provide a dynamic method invocation method which can be overloaded in classes to implement dynamic proxies easily. - returns: java.lang.Object
boolean is(java.lang.Object other)
Identity check. Since == is overridden in Groovy with the meaning of equality we need some fallback to check for object identity. - param other
- returns: boolean - true if self and other are identical, false otherwise
boolean isCase(java.lang.Object switchValue)
void print(java.lang.Object value)
Print to a console in interactive format
void print(java.io.PrintWriter out)
Print to a console in interactive format
void printf(java.lang.String format, java.lang.Object[] values)
Printf to a console. Only works with JDK1.5 or later.
void printf(java.lang.String format, java.lang.Object arg)
Returns a formatted string using the specified format string and arguments. For examples,
printf ( "Hello, %s!\n" , [ "world" ] as String[] ) printf ( "Hello, %s!\n" , [ "Groovy" ]) printf ( "%d + %d = %d\n" , [ 1 , 2 , 1+2 ] as Integer[] ) printf ( "%d + %d = %d\n" , [ 3 , 3 , 3+3 ]) ( 1..5 ).each { printf ( "-- %d\n" , [ it ] as Integer[] ) } ( 1..5 ).each { printf ( "-- %d\n" , [ it ] as int[] ) } ( 0x41..0x45 ).each { printf ( "-- %c\n" , [ it ] as char[] ) } ( 07..011 ).each { printf ( "-- %d\n" , [ it ] as byte[] ) } ( 7..11 ).each { printf ( "-- %d\n" , [ it ] as short[] ) } ( 7..11 ).each { printf ( "-- %d\n" , [ it ] as long[] ) } ( 7..11 ).each { printf ( "-- %5.2f\n" , [ it ] as float[] ) } ( 7..11 ).each { printf ( "-- %5.2g\n" , [ it ] as double[] ) }
- param arg Argument which is referenced by the format specifiers in the format string. The type of <code>arg</code> should be one of Object[], List, int[], short[], byte[], char[], boolean[], long[], float[], or double[].
- since JDK 1.5
- author Pilho Kim
- version 2005.07.25.02.31
void println()
Print a linebreak to the standard out.
void println(java.lang.Object value)
Print to a console in interactive format along with a newline
void println(java.io.PrintWriter out)
Print to a console in interactive format
void putAt(java.lang.String property, java.lang.Object newValue)
Allows the subscript operator to be used to set dynamically named property values. bean[somePropertyNameExpression] = foo
. The normal property notation of groovy is neater and more concise but only works with compile time known property names.
void use(java.lang.Class categoryClass, groovy.lang.Closure closure)
void use(java.util.List categoryClassList, groovy.lang.Closure closure)
Scoped use method with list of categories
void use(java.lang.Object[] array)
use() a list of categories, specifying the list as varargs:
use(CategoryClass1, CategoryClass2) { ... }
This method prevents the error of forgetting to wrap the the category classes in a list.
java.lang.Object[]
java.util.List getAt(java.util.Collection indices)
Allows a List to be used as the indices to be used on a List - param indices a Collection of indices
- returns: java.util.List - a new list of the values at the given indices
java.util.List getAt(groovy.lang.Range range)
Support the range subscript operator for an Array - param range a Range
- returns: java.util.List - a range of a list from the range's from index up to but not including the ranges's to value
java.util.List getAt(groovy.lang.IntRange range)
java.util.List getAt(groovy.lang.ObjectRange range)
java.lang.Object getAt(int idx)
Support the subscript operator for an Array - param idx an index
- returns: java.lang.Object - the value at the given index
java.lang.Object inject(java.lang.Object value, groovy.lang.Closure closure)
Iterates through the given array of objects, passing in the initial value to the closure along with the current iterated item then passing into the next iteration the value of the previous closure. - param value a value
- param closure a closure
- returns: java.lang.Object - the last value of the last iteration
java.lang.String join(java.lang.String separator)
Concatenates all of the elements of the array together with the given String as a separator - param separator a String separator
- returns: java.lang.String - the joined String
void putAt(int idx, java.lang.Object value)
Support the subscript operator for an Array - param idx an index
- param value an Object to put at the given index
int size()
Makes an Array look like a Collection by adding support for the size() method - returns: int - the size of the Array
groovy.lang.SpreadList spread()
Returns the converted SpreadList
of the given self
. This is the same method to toSpreadList(Object[] self)
.
For examples, if there is defined a function like as
def fn(a, b, c, d) { return a + b + c + d }
, then all of the following three have the same meaning. println fn(([1, 2, 3] as Object[]).spread(), 4) println fn(*[1, 2, 3], 4) println fn(1, 2, 3, 4)
- returns: groovy.lang.SpreadList - a newly created SpreadList if this array is not null and its size is positive.
java.lang.String toArrayString()
Returns the string representation of the given array with the brace boundaries. - returns: java.lang.String - the string representation
java.util.List toList()
Allows conversion of arrays into a mutable List - returns: java.util.List - the array as a List
groovy.lang.SpreadList toSpreadList()
Returns the converted SpreadList
of the given self
. For examples, if there is defined a function like as
def fn(a, b, c, d) { return a + b + c + d }
, then all of the following three have the same meaning. println fn(([1, 2, 3] as Object[]).toSpreadList(), 4) println fn(*[1, 2, 3], 4) println fn(1, 2, 3, 4)
- returns: groovy.lang.SpreadList - a newly created SpreadList if this array is not null and its size is positive.
groovy.lang.SpreadMap toSpreadMap()
- returns: groovy.lang.SpreadMap
java.lang.String toString()
Returns the string representation of the given array with the brace boundaries. - returns: java.lang.String - the string representation
java.lang.Process
void consumeProcessOutput()
gets the input and error streams from a process and reads them to avoid the process to block due to a full ouput buffer. For this two Threads are started, so this method will return immediately
java.io.InputStream getErr()
An alias method so that a process appears similar to System.out, System.in, System.err; you can use process.in, process.out, process.err in a similar way - returns: java.io.InputStream - an InputStream
java.io.InputStream getIn()
An alias method so that a process appears similar to System.out, System.in, System.err; you can use process.in, process.out, process.err in a similar way - returns: java.io.InputStream - an InputStream
java.io.OutputStream getOut()
An alias method so that a process appears similar to System.out, System.in, System.err; you can use process.in, process.out, process.err in a similar way - returns: java.io.OutputStream - an OutputStream
java.lang.String getText()
Read the text of the output stream of the Process. - returns: java.lang.String - the text of the output
- throws: java.io.IOException - IOException
java.io.Writer leftShift(java.lang.Object value)
Overloads the left shift operator to provide an append mechanism to pipe into a Process - param value a value to append
- returns: java.io.Writer - a Writer
- throws: java.io.IOException
java.io.OutputStream leftShift(byte[] value)
Overloads the left shift operator to provide an append mechanism to pipe into a Process - param value a value to append
- returns: java.io.OutputStream - an OutputStream
- throws: java.io.IOException
void waitForOrKill(long numberOfMillis)
Wait for the process to finish during a certain amount of time, otherwise stops the process. - param numberOfMillis the number of milliseconds to wait before stopping the process
java.lang.String
java.lang.String center(java.lang.Number numberOfChars, java.lang.String padding)
Center a String and padd it with the characters appended around it - param padding the charaters used for padding
- returns: java.lang.String - the String centered with padded character around
java.lang.String center(java.lang.Number numberOfChars)
Center a String and padd it with spaces appended around it - returns: java.lang.String - the String centered with padded character around
boolean contains(java.lang.String text)
Provide an implementation of contains() like Collection to make Strings more polymorphic This method is not required on JDK 1.5 onwards - param text a String to look for
- returns: boolean - true if this string contains the given text
int count(java.lang.String text)
Count the number of occurencies of a substring - param text a substring
- returns: int - the number of occurrencies of the given string inside this String
byte[] decodeBase64()
Decode the Sting from base64 into a byte array - returns: byte[] - the decoded bytes as an array
void eachMatch(java.lang.String regex, groovy.lang.Closure closure)
Process each regex group matched substring of the given string. If the closure parameter takes one argument an array with all match groups is passed to it. If the closure takes as many arguments as there are match groups, then each parameter will be one match group. - param regex a Regex string
- param closure a closure with one parameter or as much parameters as groups
- author bing ran
- author Pilho Kim
- author Jochen Theodorou
java.lang.Process execute()
Executes the given string as a command line process. For more control over the process mechanism in JDK 1.5 you can use java.lang.ProcessBuilder. - returns: java.lang.Process - the Process which has just started for this command line string
- throws: java.io.IOException
java.lang.Process execute(java.lang.String[] envp, java.io.File dir)
Executes the command specified by the self
with environments envp
under the working directory dir
. For more control over the process mechanism in JDK 1.5 you can use java.lang.ProcessBuilder
. - param envp an array of Strings, each element of which has environment variable settings in the format <i>name</i>=<i>value</i>, or <tt>null</tt> if the subprocess should inherit the environment of the current process.
- param dir the working directory of the subprocess, or <tt>null</tt> if the subprocess should inherit the working directory of the current process.
- returns: java.lang.Process - the Process which has just started for this command line string.
- throws: java.io.IOException
java.lang.Process execute(java.util.List envp, java.io.File dir)
Executes the command specified by the self
with environments envp
under the working directory dir
. For more control over the process mechanism in JDK 1.5 you can use java.lang.ProcessBuilder
. - param envp a List of Strings, each member of which has environment variable settings in the format <i>name</i>=<i>value</i>, or <tt>null</tt> if the subprocess should inherit the environment of the current process.
- param dir the working directory of the subprocess, or <tt>null</tt> if the subprocess should inherit the working directory of the current process.
- returns: java.lang.Process - the Process which has just started for this command line string.
- throws: java.io.IOException
java.lang.String getAt(int index)
Support the subscript operator for String - returns: java.lang.String - the Character object at the given index
java.lang.String getAt(groovy.lang.IntRange range)
Support the range subscript operator for String with IntRange - param range an IntRange
- returns: java.lang.String - the resulting String
java.lang.String getAt(groovy.lang.Range range)
Support the range subscript operator for String - param range a Range
- returns: java.lang.String - a substring corresponding to the Range
java.lang.String getAt(java.util.Collection indices)
Allows a List to be used as the indices to be used on a String - param indices a Collection of indices
- returns: java.lang.String - a String of the values at the given indices
boolean isCase(java.lang.Object switchValue)
java.lang.StringBuffer leftShift(java.lang.Object value)
Overloads the left shift operator to provide an easy way to append multiple objects as string representations to a String - param value an Obect
- returns: java.lang.StringBuffer - a StringBuffer
java.lang.String minus(java.lang.Object value)
Remove a part of a String - param value a String part to remove
- returns: java.lang.String - a String minus the part to be removed
java.lang.String multiply(java.lang.Number factor)
Repeat a String a certain number of times - param factor the number of times the String should be repeated
- returns: java.lang.String - a String composed of a repeatition
java.util.regex.Pattern negate()
Turns a String into a regular expression pattern - returns: java.util.regex.Pattern - the regular expression pattern
java.lang.String next()
This method is called by the ++ operator for the class String. It increments the last character in the given string. If the character in the string is Character.MAX_VALUE a Character.MIN_VALUE will be appended. The empty string is incremented to a string consisting of the character Character.MIN_VALUE. - returns: java.lang.String - an incremented String
java.lang.String padLeft(java.lang.Number numberOfChars, java.lang.String padding)
Pad a String with the characters appended to the left - param padding the charaters used for padding
- returns: java.lang.String - the String padded to the left
java.lang.String padLeft(java.lang.Number numberOfChars)
Pad a String with the spaces appended to the left - returns: java.lang.String - the String padded to the left
java.lang.String padRight(java.lang.Number numberOfChars, java.lang.String padding)
Pad a String with the characters appended to the right - param padding the charaters used for padding
- returns: java.lang.String - the String padded to the right
java.lang.String padRight(java.lang.Number numberOfChars)
Pad a String with the spaces appended to the right - returns: java.lang.String - the String padded to the right
java.lang.String plus(java.lang.Object value)
Appends a String - param value a String
- returns: java.lang.String - a String
java.lang.String previous()
This method is called by the -- operator for the class String. It decrements the last character in the given string. If the character in the string is Character.MIN_VALUE it will be deleted. The empty string can't be decremented. - returns: java.lang.String - a String with a decremented digit at the end
java.lang.String replaceAll(java.lang.String regex, groovy.lang.Closure closure)
Replaces all occurrencies of a captured group by the result of a closure on that text. For examples,
assert "FOOBAR-FOOBAR-" == "foobar-FooBar-".replaceAll("(([fF][oO]{2})[bB]ar)", { Object[] it -> it[0].toUpperCase() }) Here, it[0] is the global string of the matched group it[1] is the first string in the matched group it[2] is the second string in the matched group assert "FOO-FOO-" == "foobar-FooBar-".replaceAll("(([fF][oO]{2})[bB]ar)", { x, y, z -> z.toUpperCase() }) Here, x is the global string of the matched group y is the first string in the matched group z is the second string in the matched group
- param regex the capturing regex
- param closure the closure to apply on each captured group
- returns: java.lang.String - a String with replaced content
java.lang.String reverse()
Creates a new string which is the reverse (backwards) of this string - returns: java.lang.String - a new string with all the characters reversed.
int size()
Makes a String look like a Collection by adding support for the size() method - returns: int - the length of the String
java.math.BigDecimal toBigDecimal()
Parse a String into a BigDecimal - returns: java.math.BigDecimal - a BigDecimal
java.math.BigInteger toBigInteger()
Parse a String into a BigInteger - returns: java.math.BigInteger - a BigInteger
java.lang.Boolean toBoolean()
Converts the given string into a Boolean object If the trimmed string is "true", "y" or "1" (ignoring case) then the result is true othewrwise it is false - returns: java.lang.Boolean - The Boolean value
java.lang.Character toCharacter()
Converts the given string into a Character object using the first character in the string - returns: java.lang.Character - the first Character
java.lang.Double toDouble()
Parse a String into a Double - returns: java.lang.Double - a Double
java.lang.Float toFloat()
Parse a String into a Float - returns: java.lang.Float - a Float
java.lang.Integer toInteger()
Parse a String into an Integer - returns: java.lang.Integer - an Integer
java.util.List toList()
Converts the given String into a List of strings of one character - returns: java.util.List - a List of characters (a 1-character String)
java.lang.Long toLong()
Parse a String into a Long - returns: java.lang.Long - a Long
java.net.URI toURI()
Transforms a String representing a URI into a URI object. - returns: java.net.URI - a URI
- throws: java.net.URISyntaxException - URISyntaxException
java.net.URL toURL()
Transforms a String representing a URL into a URL object. - returns: java.net.URL - a URL
- throws: java.net.MalformedURLException - MalformedURLException is thrown if the URL is not well formed.
java.util.List tokenize(java.lang.String token)
Tokenize a String - param token the delimiter
- returns: java.util.List - a List of tokens
java.util.List tokenize()
Tokenize a String (with a whitespace as delimiter) - returns: java.util.List - a List of tokens
java.lang.StringBuffer
java.lang.StringBuffer leftShift(java.lang.Object value)
Overloads the left shift operator to provide an easy way to append multiple objects as string representations to a StringBuffer - param value a value to append
- returns: java.lang.StringBuffer - a StringBuffer
java.lang.String plus(java.lang.String value)
Appends a String - param value a String
- returns: java.lang.String - a String
void putAt(groovy.lang.IntRange range, java.lang.Object value)
Support the range subscript operator for StringBuffer - param range a Range
- param value the object that's toString() will be inserted
void putAt(groovy.lang.EmptyRange range, java.lang.Object value)
Support the range subscript operator for StringBuffer - param range a Range
- param value the object that's toString() will be inserted
int size()
Provide standard Groovy size() method for StringBuffers - returns: int - the length of the StringBuffer
java.lang.String[]
java.lang.Process execute()
Executes the command specified by the String
array that is the parameter. The first item in the array is the command the others are the parameters. For more control over the process mechanism in JDK 1.5 you can use java.lang.ProcessBuilder
. - returns: java.lang.Process - the Process which has just started for this command line string.
- throws: java.io.IOException
java.math.BigDecimal
void downto(java.lang.Number to, groovy.lang.Closure closure)
void upto(java.lang.Number to, groovy.lang.Closure closure)
java.math.BigInteger
void downto(java.lang.Number to, groovy.lang.Closure closure)
void upto(java.lang.Number to, groovy.lang.Closure closure)
java.net.ServerSocket
java.net.Socket accept(groovy.lang.Closure closure)
Allow to pass a Closure to the accept methods of ServerSocket - param closure a Closure
- returns: java.net.Socket - a Socket
- throws: java.io.IOException - IOException
java.net.Socket
java.io.Writer leftShift(java.lang.Object value)
Overloads the left shift operator to provide an append mechanism to add things to the output stream of a socket - param value a value to append
- returns: java.io.Writer - a Writer
- throws: java.io.IOException
java.io.OutputStream leftShift(byte[] value)
Overloads the left shift operator to provide an append mechanism to add bytes to the output stream of a socket - param value a value to append
- returns: java.io.OutputStream - an OutputStream
- throws: java.io.IOException
void withStreams(groovy.lang.Closure closure)
Allows an InputStream and an OutputStream from a Socket to be used, calling the closure with the streams and then ensuring that the streams are closed down again irrespective of whether exceptions occur. - param closure a Closure
- throws: java.io.IOException - IOException
java.net.URL
void eachByte(groovy.lang.Closure closure)
Traverse through each byte of the specified URL - param closure closure to apply to each byte
- throws: java.io.IOException - IOException
void eachLine(groovy.lang.Closure closure)
Iterates through the lines read from the URL's associated input stream - param closure a closure to apply on each line
- throws: java.io.IOException - IOException
java.lang.String getText()
Reads the content of this URL and returns it as a String - returns: java.lang.String - the text from that URL
- throws: java.io.IOException - IOException
java.lang.String getText(java.lang.String charset)
Reads the content of this URL and returns it as a String - param charset opens the stream with a specified charset
- returns: java.lang.String - the text from that URL
- throws: java.io.IOException - IOException
void withReader(groovy.lang.Closure closure)
Helper method to create a new BufferedReader for a URL and then passes it into the closure and ensures its closed again afterwords - throws: java.io.IOException - FileNotFoundException
java.sql.Date
java.sql.Date minus(int days)
Subtracts a number of days from this date and returns the new date - returns: java.sql.Date - the new date
java.sql.Date next()
Increments a java.sql.Date by a day - returns: java.sql.Date - the next days date
java.sql.Date plus(int days)
Adds a number of days to this date and returns the new date - param days the number of days to increase
- returns: java.sql.Date - the new date
java.sql.Date previous()
Decrement a java.sql.Date by a day - returns: java.sql.Date - the previous days date
java.util.Collection
java.util.Collection asImmutable()
A convenience method for creating an immutable Collection - returns: java.util.Collection - an immutable Collection
java.util.List asList()
Converts the given collection into a List - returns: java.util.List - a newly created List if this collection is not already a List
java.util.Collection asSynchronized()
A convenience method for creating a synchronized Collection - returns: java.util.Collection - a synchronized Collection
java.util.List collect(groovy.lang.Closure closure)
Iterates through this collection transforming each entry into a new value using the closure as a transformer, returning a list of transformed values. - param closure the closure used for mapping
- returns: java.util.List - a List of the mapped values
java.util.Collection collect(java.util.Collection collection, groovy.lang.Closure closure)
Iterates through this collection transforming each entry into a new value using the closure as a transformer, returning a list of transformed values. - param collection the Collection to which the mapped values are added
- param closure the closure used to map each element of the collection
- returns: java.util.Collection - the resultant collection
int count(java.lang.Object value)
Counts the number of occurencies of the given value inside this collection - param value the value
- returns: int - the number of occurrencies
boolean disjoint(java.util.Collection right)
Returns true
if the intersection of two collenctions is empty. - param right a Collection
- returns: boolean - boolean <code>true</code> if the intersection of two collenctions is empty, <code>false</code> otherwise.
void each(groovy.lang.Closure closure)
Allows objects to be iterated through using a closure - param closure the closure applied on each element of the collection
java.lang.Object find(groovy.lang.Closure closure)
Finds the first value matching the closure condition - param closure a closure condition
- returns: java.lang.Object - the first Object found
java.util.List findAll(groovy.lang.Closure closure)
Finds all values matching the closure condition - param closure a closure condition
- returns: java.util.List - a List of the values found
java.util.List getAt(java.lang.String property)
Support the subscript operator for List - param property a String
- returns: java.util.List - a List
java.lang.Object inject(java.lang.Object value, groovy.lang.Closure closure)
Iterates through the given collection, passing in the initial value to the closure along with the current iterated item then passing into the next iteration the value of the previous closure. - param value a value
- param closure a closure
- returns: java.lang.Object - the last value of the last iteration
boolean isCase(java.lang.Object switchValue)
java.lang.String join(java.lang.String separator)
Concatenates all of the items of the collection together with the given String as a separator - param separator a String separator
- returns: java.lang.String - the joined String
java.util.Collection leftShift(java.lang.Object value)
Overloads the left shift operator to provide an easy way to append objects to a list - param value an Object to be added to the collection.
- returns: java.util.Collection - a Collection with an Object added to it.
java.lang.Object max()
Selects the maximum value found in the collection - returns: java.lang.Object - the maximum value
java.lang.Object max(org.codehaus.groovy.runtime.DefaultGroovyMethods$NumberComparator comparator)
Selects the maximum value found in the collection using the given comparator - param comparator a Comparator
- returns: java.lang.Object - the maximum value
java.lang.Object max(groovy.lang.Closure closure)
Selects the maximum value found in the collection using the given closure as a comparator - param closure a closure used as a comparator
- returns: java.lang.Object - the maximum value
java.lang.Object min()
Selects the minimum value found in the collection - returns: java.lang.Object - the minimum value
java.lang.Object min(org.codehaus.groovy.runtime.DefaultGroovyMethods$NumberComparator comparator)
Selects the minimum value found in the collection using the given comparator - param comparator a Comparator
- returns: java.lang.Object - the minimum value
java.lang.Object min(groovy.lang.Closure closure)
Selects the minimum value found in the collection using the given closure as a comparator - param closure a closure used as a comparator
- returns: java.lang.Object - the minimum value
java.util.List multiply(java.lang.Number factor)
Create a List composed of the same elements repeated a certain number of times. - param factor the number of times to append
- returns: java.util.List - a List
java.util.List plus(java.util.Collection right)
Create a List as a union of both Collections - param right the right Collection
- returns: java.util.List - a List
java.util.List plus(java.lang.Object right)
Create a List as a union of a Collection and an Object - param right an object to append
- returns: java.util.List - a List
java.util.List sort()
Sorts the given collection into a sorted list. - returns: java.util.List - the sorted collection as a List
java.util.List sort(org.codehaus.groovy.runtime.DefaultGroovyMethods$NumberComparator comparator)
A convenience method for sorting a Collection with a specific comparator - param comparator a Comparator used for the comparison
- returns: java.util.List - a newly created sorted List
java.util.List sort(groovy.lang.Closure closure)
A convenience method for sorting a Collection using a closure as a comparator - param closure a Closure used as a comparator
- returns: java.util.List - a newly created sorted List
java.lang.Object sum()
Sums a collection of numeric values. coll.sum()
is equivalent to: coll.inject(0) {value, item -> value + item}
. - returns: java.lang.Object - The sum of all of the list itmems.
java.lang.Object sum(groovy.lang.Closure closure)
Sums the result of apply a closure to each item of a collection. coll.sum(closure)
is equivalent to: coll.collect(closure).sum()
. - param closure a single parameter closure that returns a numeric value.
- returns: java.lang.Object - The sum of the values returned by applying the closure to each item of the list.
java.util.List toList()
Convert a collection to a List. - returns: java.util.List - a List
java.lang.String toListString()
Returns the string representation of the given collection with the bracket boundaries. - returns: java.lang.String - the string representation
java.lang.String toString()
Returns the string representation of the given collection with the bracket boundaries. - returns: java.lang.String - the string representation
java.util.Collection unique()
Remove all duplicates from a given Collection. Works on the receiver object and returns it. For each duplicate, only the first member which is returned by the given Collection's iterator is retained, but all other ones are removed. The given Collection's original order is retained. If there exists numbers in the Collection, then they are compared as numbers, that is, 2, 2.0, 3L, (short)4 are comparable.
def x = [2, 2.0, 3L, 1.0, (short)4, 1] def y = x.unique() assert( y == x && x == [2, 3L, 1.0, (short)4] )
- returns: java.util.Collection - self without duplicates
java.util.Collection unique(org.codehaus.groovy.runtime.DefaultGroovyMethods$NumberComparator comparator)
Remove all duplicates from a given Collection. Works on the receiver object and returns it. The order of members in the Collection are compared by the given Comparator. For eachy duplicate, the first member which is returned by the given Collection's iterator is retained, but all other ones are removed. The given Collection's original order is retained.
class Person { - param self a Collection
- param comparator a Comparator.
- returns: java.util.Collection - self without duplicates
java.util.Date
java.util.Date minus(int days)
Subtracts a number of days from this date and returns the new date - returns: java.util.Date - the new date
java.util.Date next()
Increments a Date by a day - returns: java.util.Date - the next days date
java.util.Date plus(int days)
Adds a number of days to this date and returns the new date - param days the number of days to increase
- returns: java.util.Date - the new date
java.util.Date previous()
Decrement a Date by a day - returns: java.util.Date - the previous days date
java.util.List
java.util.List asImmutable()
A convenience method for creating an immutable list - returns: java.util.List - an immutable List
java.util.List asSynchronized()
A convenience method for creating a synchronized List - returns: java.util.List - a synchronized List
boolean equals(java.util.List right)
Compare two Lists. If numbers exits in the Lists, then they are compared as numbers, for example 2 == 2L. - param right a List
- returns: boolean - boolean <code>true</code> if two Lists equals, <code>false</code> otherwise.
java.lang.Process execute()
Executes the command specified by the String
list that is the parameter. The first item in the array is the command the others are the parameters. All entries must be String
s. For more control over the process mechanism in JDK 1.5 you can use java.lang.ProcessBuilder
. - returns: java.lang.Process - the Process which has just started for this command line string.
- throws: java.io.IOException
java.util.List flatten()
Flatten a list - returns: java.util.List - a flattened List
java.util.List getAt(groovy.lang.IntRange range)
Support the range subscript operator for a List - param range a Range
- see java.util.List#subList(int, int)
- returns: java.util.List - a sublist based on range borders or a new list if range is reversed
java.util.List getAt(java.util.Collection indices)
Allows a List to be used as the indices to be used on a List - param indices a Collection of indices
- returns: java.util.List - a new list of the values at the given indices
java.lang.Object getAt(int idx)
Support the subscript operator for a List - param idx an index
- returns: java.lang.Object - the value at the given index
java.util.List intersect(java.util.Collection right)
Create a List composed of the intersection of both collections - param right a Collection
- returns: java.util.List - a List as an intersection of both collections
java.util.List minus(java.util.Collection removeMe)
Create a List composed of the elements of the first list minus the elements of the collection - param removeMe a Collection of elements to remove
- returns: java.util.List - a List with the common elements removed
java.lang.Object pop()
Removes the last item from the List. Using add() and pop() is similar to push and pop on a Stack. - returns: java.lang.Object - the item removed from the List
void putAt(int idx, java.lang.Object value)
A helper method to allow lists to work with subscript operators - param idx an index
- param value the value to put at the given index
void putAt(groovy.lang.EmptyRange range, java.lang.Object value)
A helper method to allow lists to work with subscript operators - param range the subset of the list to set
- param value the values to put at the given sublist or a Collection of values
void putAt(groovy.lang.IntRange range, java.lang.Object value)
A helper method to allow lists to work with subscript operators - param range the subset of the list to set
- param value the value to put at the given sublist or a Collection of values
void putAt(java.util.List splice, java.util.List values)
A helper method to allow lists to work with subscript operators - param splice the subset of the list to set
- param values the value to put at the given sublist
- deprecated replace with putAt(List self, Range range, List value)
void putAt(java.util.List splice, java.lang.Object value)
A helper method to allow lists to work with subscript operators - param splice the subset of the list to set
- param value the value to put at the given sublist
- deprecated replace with putAt(List self, Range range, Object value)
java.util.List reverse()
Reverses the list - returns: java.util.List - a reversed List
void reverseEach(groovy.lang.Closure closure)
Iterate over each element of the list in the reverse order.
java.util.List sort()
A convenience method for sorting a List - returns: java.util.List - the sorted List
java.util.List sort(org.codehaus.groovy.runtime.DefaultGroovyMethods$NumberComparator comparator)
A convenience method for sorting a List with a specific comparator - param comparator a Comparator used for the comparison
- returns: java.util.List - a sorted List
java.util.List sort(groovy.lang.Closure closure)
A convenience method for sorting a List using a closure as a comparator - param closure a Closure used as a comparator
- returns: java.util.List - a sorted List
groovy.lang.SpreadList spread()
Returns the converted SpreadList
of the given self
. This is the same method to toSpreadList(List self)
.
For examples, if there is defined a function like as
def fn(a, b, c, d) { return a + b + c + d }
, then all of the following three have the same meaning. println fn(1, [2, 3].spread(), 4) println fn(1, *[2, 3], 4) println fn(1, 2, 3, 4)
- returns: groovy.lang.SpreadList - a newly created SpreadList if this list is not null and its size is positive.
groovy.lang.SpreadList toSpreadList()
Returns the converted SpreadList
of the given self
. For examples, if there is defined a function like as
def fn(a, b, c, d) { return a + b + c + d }
, then all of the following three have the same meaning. println fn(1, [2, 3].toSpreadList(), 4) println fn(1, *[2, 3], 4) println fn(1, 2, 3, 4)
- returns: groovy.lang.SpreadList - a newly created SpreadList if this list is not null and its size is positive.
java.util.Map
java.util.Map asImmutable()
A convenience method for creating an immutable map - returns: java.util.Map - an immutable Map
java.util.Map asSynchronized()
A convenience method for creating a synchronized Map - returns: java.util.Map - a synchronized Map
java.util.Collection collect(java.util.Collection collection, groovy.lang.Closure closure)
Iterates through this Map transforming each entry into a new value using the closure as a transformer, returning a list of transformed values. - param closure the closure used for mapping, which can be with one(Map.Entry) or two(key, value) parameters
- returns: java.util.Collection - a List of the mapped values
java.util.List collect(groovy.lang.Closure closure)
Iterates through this Map transforming each entry into a new value using the closure as a transformer, returning a list of transformed values. - param closure the closure used to map each element of the collection
- returns: java.util.List - the resultant collection
void each(groovy.lang.Closure closure)
Allows a Map to be iterated through using a closure. If the closure takes one parameter then it will be passed the Map.Entry otherwise if the closure takes two parameters then it will be passed the key and the value. - param closure the closure applied on each entry of the map
java.lang.Object find(groovy.lang.Closure closure)
Finds the first value matching the closure condition - param closure a closure condition
- returns: java.lang.Object - the first Object found
java.util.Map findAll(groovy.lang.Closure closure)
Finds all entries matching the closure condition. If the closure takes one parameter then it will be passed the Map.Entry otherwise if the closure takes two parameters then it will be passed the key and the value. - param closure a closure condition applying on the entries
- returns: java.util.Map - a new subMap
java.lang.Object get(java.lang.Object key, java.lang.Object defaultValue)
Looks up an item in a Map for the given key and returns the value - unless there is no entry for the given key in which case add the default value to the map and return that. - param key the key to lookup the value of
- param defaultValue the value to return and add to the map for this key if there is no entry for the given key
- returns: java.lang.Object - the value of the given key or the default value, added to the map if the key did not exist
java.lang.Object getAt(java.lang.Object key)
Support the subscript operator for a List - param key an Object as a key for the map
- returns: java.lang.Object - the value corresponding to the given key
java.lang.Object putAt(java.lang.Object key, java.lang.Object value)
A helper method to allow lists to work with subscript operators - param key an Object as a key for the map
- returns: java.lang.Object - the value corresponding to the given key
groovy.lang.SpreadMap spread()
- returns: groovy.lang.SpreadMap
java.util.Map subMap(java.util.Collection keys)
Creates a sub-Map containing the given keys. This method is similar to List.subList() but uses keys rather than index ranges. - param keys a Collection of keys
- returns: java.util.Map - a new Map containing the given keys
java.lang.String toMapString()
Returns the string representation of the given map with bracket boundaries. - returns: java.lang.String - the string representation
groovy.lang.SpreadMap toSpreadMap()
Returns the converted SpreadList
of the given self
. For examples, if there is defined a function like as
def fn(a, b, c, d) { return a + b + c + d }
, then all of the following three have the same meaning. println fn(a:1, [b:2, c:3].toSpreadMap(), d:4) println fn(a:1, *:[b:2, c:3], d:4) println fn(a:1, b:2, c:3, d:4)
- returns: groovy.lang.SpreadMap - a newly created SpreadList if this list is not null and its size is positive.
java.lang.String toString()
Returns the string representation of the given map with bracket boundaries. - returns: java.lang.String - the string representation
java.util.Set
java.util.Set asImmutable()
A convenience method for creating an immutable list - returns: java.util.Set - an immutable Set
java.util.Set asSynchronized()
A convenience method for creating a synchronized Set - returns: java.util.Set - a synchronized Set
java.util.SortedMap
java.util.SortedMap asImmutable()
A convenience method for creating an immutable sorted map - returns: java.util.SortedMap - an immutable SortedMap
java.util.SortedMap asSynchronized()
A convenience method for creating a synchronized SortedMap - returns: java.util.SortedMap - a synchronized SortedMap
java.util.SortedSet
java.util.SortedSet asImmutable()
A convenience method for creating an immutable sorted set - returns: java.util.SortedSet - an immutable SortedSet
java.util.SortedSet asSynchronized()
A convenience method for creating a synchronized SortedSet - returns: java.util.SortedSet - a synchronized SortedSet
java.util.SortedSet sort()
Avoids doing unnecessary work when sorting an already sorted set - returns: java.util.SortedSet - the sorted set
java.util.Timer
void runAfter(int delay, groovy.lang.Closure closure)
Allow simple syntax for using timers. - param delay the delay in milliseconds before running the closure code
- param closure
java.util.regex.Matcher
void each(groovy.lang.Closure closure)
Process each matched substring of the given group matcher. The object passed to the closure is an array of strings, matched per a successful match. - param closure a closure
- author bing ran
- author Pilho Kim
java.lang.Object getAt(int idx)
Support the subscript operator, e.g. matcher[index], for a regex Matcher. For an example using no group match,
def p = /ab[d|f]/ def m = "abcabdabeabf" =~ p for (i in 0..
For an example using group matches,
def p = /(?:ab([c|d|e|f]))/ def m = "abcabdabeabf" =~ p for (i in 0..
For another example using group matches,
def m = "abcabdabeabfabxyzabx" =~ /(?:ab([d|x-z]+))/ m.count.times { println( "m.groupCount() = " + m.groupCount()) println( " " + it + ": " + m[it] ) // m[it] is a List }
- param idx an index
- returns: java.lang.Object - object a matched String if no groups matched, list of matched groups otherwise.
java.lang.String getAt(java.util.Collection indices)
Allows a List to be used as the indices to be used on a Matcher - param indices a Collection of indices
- returns: java.lang.String - a String of the values at the given indices
int getCount()
Find the number of Strings matched to the given Matcher. - returns: int - int the number of Strings matched to the given matcher.
boolean hasGroup()
Check whether a Matcher contains a group or not. - returns: boolean - boolean <code>true</code> if matcher contains at least one group.
void setIndex(int idx)
Set the position of the given Matcher to the given index. - param idx the index number
long size()
Provide the standard Groovy size method
java.util.regex.Pattern
boolean isCase(java.lang.Object switchValue)
long
void downto(java.lang.Number to, groovy.lang.Closure closure)
void upto(java.lang.Number to, groovy.lang.Closure closure)
long[]
java.lang.Object getAt(int idx)
- returns: java.lang.Object
java.lang.Object getAt(groovy.lang.Range range)
- returns: java.lang.Object
java.lang.Object getAt(groovy.lang.IntRange range)
- returns: java.lang.Object
java.lang.Object getAt(groovy.lang.ObjectRange range)
- returns: java.lang.Object
java.lang.Object getAt(java.util.Collection indices)
- returns: java.lang.Object
void putAt(int idx, java.lang.Object newValue)
int size()
java.util.List toList()
short[]
java.lang.Object getAt(int idx)
- returns: java.lang.Object
java.lang.Object getAt(groovy.lang.Range range)
- returns: java.lang.Object
java.lang.Object getAt(groovy.lang.IntRange range)
- returns: java.lang.Object
java.lang.Object getAt(groovy.lang.ObjectRange range)
- returns: java.lang.Object
java.lang.Object getAt(java.util.Collection indices)
- returns: java.lang.Object
void putAt(int idx, java.lang.Object newValue)
int size()
java.util.List toList()