This class defines new groovy methods which appear on normal JDK
classes inside the Groovy environment. Static methods are used with the
first parameter being the destination class,
i.e. public static String reverse(String self)
provides a reverse()
method for String
.
NOTE: While this class contains many 'public' static methods, it is primarily regarded as an internal class (its internal package name suggests this also). We value backwards compatibility of these methods when used within Groovy but value less backwards compatibility at the Java method call level. I.e. future versions of Groovy may remove or move a method call in this file but would normally aim to keep the method available from within Groovy.
Modifiers | Name | Description |
---|---|---|
static Class[] |
ADDITIONAL_CLASSES |
|
static Class[] |
DGM_LIKE_CLASSES |
Type Params | Return Type | Name and description |
---|---|---|
|
static int |
abs(Number number) Get the absolute value |
|
static long |
abs(Long number) Get the absolute value |
|
static float |
abs(Float number) Get the absolute value |
|
static double |
abs(Double number) Get the absolute value |
|
static Socket |
accept(ServerSocket serverSocket, Closure closure) |
|
static Socket |
accept(ServerSocket serverSocket, boolean runInANewThread, Closure closure) |
<T> |
static boolean |
addAll(Collection<T> self, T[] items) Modifies the collection by adding all of the elements in the specified array to the collection. |
<T> |
static boolean |
addAll(List<T> self, int index, T[] items) Modifies this list by inserting all of the elements in the specified array into the list at the specified position. |
<T> |
static boolean |
addAll(Collection<T> self, Iterator<? extends T> items) Adds all items from the iterator to the Collection. |
<T> |
static boolean |
addAll(Collection<T> self, Iterable<? extends T> items) Adds all items from the iterable to the Collection. |
|
static void |
addShutdownHook(Object self, Closure closure) Allows the usage of addShutdownHook without getting the runtime first. |
|
static Number |
and(Number left, Number right) Bitwise AND together two Numbers. |
|
static BitSet |
and(BitSet left, BitSet right) Bitwise AND together two BitSets. |
|
static Boolean |
and(Boolean left, Boolean right) Logical conjunction of two boolean operators. |
|
static boolean |
any(Object self, Closure closure) Iterates over the contents of an object or collection, and checks whether a predicate is valid for at least one element. |
<T> |
static boolean |
any(Iterator<T> self, Closure closure) Iterates over the contents of an iterator, and checks whether a predicate is valid for at least one element. |
<T> |
static boolean |
any(Iterable<T> self, Closure closure) Iterates over the contents of an iterable, and checks whether a predicate is valid for at least one element. |
<K, V> |
static boolean |
any(Map<K, V> self, Closure<?> closure) Iterates over the entries of a map, and checks whether a predicate is valid for at least one entry. |
|
static boolean |
any(Object self) Iterates over the elements of a collection, and checks whether at least one element is true according to the Groovy Truth. |
|
static void |
append(File file, Object text) |
|
static void |
append(File file, byte[] bytes) |
|
static void |
append(File self, InputStream stream) |
|
static void |
append(File file, Object text, String charset) |
|
static boolean |
asBoolean(Object object) Coerce an object instance to a boolean value. |
|
static boolean |
asBoolean(Boolean bool) Coerce a Boolean instance to a boolean value. |
|
static boolean |
asBoolean(Collection collection) Coerce a collection instance to a boolean value. |
|
static boolean |
asBoolean(Map map) Coerce a map instance to a boolean value. |
|
static boolean |
asBoolean(Iterator iterator) Coerce an iterator instance to a boolean value. |
|
static boolean |
asBoolean(Enumeration enumeration) Coerce an enumeration instance to a boolean value. |
|
static boolean |
asBoolean(Object[] array) Coerce an Object array to a boolean value. |
|
static boolean |
asBoolean(byte[] array) Coerces a byte array to a boolean value. |
|
static boolean |
asBoolean(short[] array) Coerces a short array to a boolean value. |
|
static boolean |
asBoolean(int[] array) Coerces an int array to a boolean value. |
|
static boolean |
asBoolean(long[] array) Coerces a long array to a boolean value. |
|
static boolean |
asBoolean(float[] array) Coerces a float array to a boolean value. |
|
static boolean |
asBoolean(double[] array) Coerces a double array to a boolean value. |
|
static boolean |
asBoolean(boolean[] array) Coerces a boolean array to a boolean value. |
|
static boolean |
asBoolean(char[] array) Coerces a char array to a boolean value. |
|
static boolean |
asBoolean(Character character) Coerce a character to a boolean value. |
|
static boolean |
asBoolean(Number number) Coerce a number to a boolean value. |
|
static boolean |
asBoolean(CharSequence string) |
|
static boolean |
asBoolean(Matcher matcher) |
<T> |
static Collection<T> |
asCollection(Iterable<T> self) Converts this Iterable to a Collection. |
<K, V> |
static Map<K, V> |
asImmutable(Map<? extends K, ? extends V> self) A convenience method for creating an immutable map. |
<K, V> |
static SortedMap<K, V> |
asImmutable(SortedMap<K, ? extends V> self) A convenience method for creating an immutable sorted map. |
<T> |
static List<T> |
asImmutable(List<? extends T> self) A convenience method for creating an immutable list |
<T> |
static Set<T> |
asImmutable(Set<? extends T> self) A convenience method for creating an immutable list. |
<T> |
static SortedSet<T> |
asImmutable(SortedSet<T> self) A convenience method for creating an immutable sorted set. |
<T> |
static Collection<T> |
asImmutable(Collection<? extends T> self) A convenience method for creating an immutable Collection. |
<T> |
static List<T> |
asList(Collection<T> self) @deprecated Use the Iterable version of asList instead |
<T> |
static List<T> |
asList(Iterable<T> self) Converts this Iterable to a List. |
<K, V> |
static Map<K, V> |
asSynchronized(Map<K, V> self) A convenience method for creating a synchronized Map. |
<K, V> |
static SortedMap<K, V> |
asSynchronized(SortedMap<K, V> self) A convenience method for creating a synchronized SortedMap. |
<T> |
static Collection<T> |
asSynchronized(Collection<T> self) A convenience method for creating a synchronized Collection. |
<T> |
static List<T> |
asSynchronized(List<T> self) A convenience method for creating a synchronized List. |
<T> |
static Set<T> |
asSynchronized(Set<T> self) A convenience method for creating a synchronized Set. |
<T> |
static SortedSet<T> |
asSynchronized(SortedSet<T> self) A convenience method for creating a synchronized SortedSet. |
<T> |
static T |
asType(Iterable iterable, Class<T> clazz) Converts the given iterable to another type. |
<T> |
static T |
asType(Collection col, Class<T> clazz) Converts the given collection to another type. |
<T> |
static T |
asType(Object[] ary, Class<T> clazz) Converts the given array to either a List, Set, or SortedSet. |
<T> |
static T |
asType(Closure cl, Class<T> clazz) Coerces the closure to an implementation of the given class. |
<T> |
static T |
asType(Map map, Class<T> clazz) Coerces this map to the given type, using the map's keys as the public method names, and values as the implementation. |
<T> |
static T |
asType(Number self, Class<T> c) Transform this number to a the given type, using the 'as' operator. |
<T> |
static T |
asType(Object obj, Class<T> type) Converts a given object to a type. |
<T> |
static T |
asType(CharSequence self, Class<T> c) |
<T> |
static T |
asType(GString self, Class<T> c) |
<T> |
static T |
asType(String self, Class<T> c) |
<T> |
static T |
asType(File f, Class<T> c) |
|
static File |
asWritable(File file) |
|
static File |
asWritable(File file, String encoding) |
|
static BitSet |
bitwiseNegate(BitSet self) Bitwise NEGATE a BitSet. |
|
static Number |
bitwiseNegate(Number left) Bitwise NEGATE a Number. |
|
static Pattern |
bitwiseNegate(CharSequence self) |
|
static Pattern |
bitwiseNegate(String self) |
<T> |
protected static T |
callClosureForLine(Closure<T> closure, String line, int counter) |
<T> |
protected static T |
callClosureForMapEntry(Closure<T> closure, Map.Entry entry) |
<T> |
protected static T |
callClosureForMapEntryAndCounter(Closure<T> closure, Map.Entry entry, int counter) |
|
static CharSequence |
capitalize(CharSequence self) |
|
static String |
capitalize(String self) |
|
static CharSequence |
center(CharSequence self, Number numberOfChars) |
|
static CharSequence |
center(CharSequence self, Number numberOfChars, CharSequence padding) |
|
static String |
center(String self, Number numberOfChars) |
|
static String |
center(String self, Number numberOfChars, String padding) |
<T> |
static List<List<T>> |
collate(Iterable<T> self, int size) Collates this iterable into sub-lists of length size .
|
<T> |
static List<List<T>> |
collate(List<T> self, int size) @deprecated use the Iterable variant instead |
<T> |
static List<List<T>> |
collate(Iterable<T> self, int size, int step) Collates this iterable into sub-lists of length size stepping through the code step
elements for each subList.
|
<T> |
static List<List<T>> |
collate(List<T> self, int size, int step) @deprecated use the Iterable variant instead |
<T> |
static List<List<T>> |
collate(Iterable<T> self, int size, boolean keepRemainder) Collates this iterable into sub-lists of length size . |
<T> |
static List<List<T>> |
collate(List<T> self, int size, boolean keepRemainder) @deprecated use the Iterable variant instead |
<T> |
static List<List<T>> |
collate(Iterable<T> self, int size, int step, boolean keepRemainder) Collates this iterable into sub-lists of length size stepping through the code step
elements for each sub-list. |
<T> |
static List<List<T>> |
collate(List<T> self, int size, int step, boolean keepRemainder) @deprecated use the Iterable variant instead |
<T> |
static List<T> |
collect(Object self, Closure<T> transform) Iterates through this aggregate Object transforming each item into a new value using the transform closure, returning a list of transformed values.
|
|
static Collection |
collect(Object self) Iterates through this aggregate Object transforming each item into a new value using Closure.IDENTITY as a transformer, basically returning a list of items copied from the original object. |
<T> |
static Collection<T> |
collect(Object self, Collection<T> collector, Closure<? extends T> transform) Iterates through this aggregate Object transforming each item into a new value using the transform closure
and adding it to the supplied collector . |
<S, T> |
static List<T> |
collect(Collection<S> self, Closure<T> transform) Iterates through this collection transforming each entry into a new value using the transform closure
returning a list of transformed values.
|
<T> |
static List<T> |
collect(Collection<T> self) Iterates through this collection transforming each entry into a new value using Closure.IDENTITY as a transformer, basically returning a list of items copied from the original collection. |
<T, E> |
static Collection<T> |
collect(Collection<E> self, Collection<T> collector, Closure<? extends T> transform) Iterates through this collection transforming each value into a new value using the transform closure
and adding it to the supplied collector .
|
<T, K, V> |
static Collection<T> |
collect(Map<K, V> self, Collection<T> collector, Closure<? extends T> transform) Iterates through this Map transforming each map entry into a new value using the transform closure
returning the collector with all transformed values added to it.
|
<T, K, V> |
static List<T> |
collect(Map<K, V> self, Closure<T> transform) Iterates through this Map transforming each map entry into a new value using the transform closure
returning a list of transformed values.
|
|
static List |
collectAll(Collection self, Closure transform) Deprecated alias for collectNested |
|
static Collection |
collectAll(Collection self, Collection collector, Closure transform) Deprecated alias for collectNested |
<K, V, S, T> |
static Map<K, V> |
collectEntries(Map<S, T> self, Map<K, V> collector, Closure<?> transform) Iterates through this Map transforming each map entry using the transform closure
returning a map of the transformed entries.
|
<K, V> |
static Map<?, ?> |
collectEntries(Map<K, V> self, Closure<?> transform) Iterates through this Map transforming each entry using the transform closure
and returning a map of the transformed entries.
|
<K, V> |
static Map<K, V> |
collectEntries(Collection<?> self, Closure<?> transform) @deprecated Use the Iterable version of collectEntries instead |
<K, V, E> |
static Map<K, V> |
collectEntries(Iterator<E> self, Closure<?> transform) A variant of collectEntries for Iterators. |
<K, V, E> |
static Map<K, V> |
collectEntries(Iterable<E> self, Closure<?> transform) Iterates through this Iterable transforming each item using the transform closure
and returning a map of the resulting transformed entries.
|
<K, V> |
static Map<K, V> |
collectEntries(Collection<?> self) @deprecated Use the Iterable version of collectEntries instead |
<K, V> |
static Map<K, V> |
collectEntries(Iterator<?> self) A variant of collectEntries for Iterators using the identity closure as the transform. |
<K, V> |
static Map<K, V> |
collectEntries(Iterable<?> self) A variant of collectEntries for Iterable objects using the identity closure as the transform. |
<K, V> |
static Map<K, V> |
collectEntries(Collection<?> self, Map<K, V> collector, Closure<?> transform) @deprecated Use the Iterable version of collectEntries instead |
<K, V, E> |
static Map<K, V> |
collectEntries(Iterator<E> self, Map<K, V> collector, Closure<?> transform) A variant of collectEntries for Iterators using a supplied map as the destination of transformed entries. |
<K, V, E> |
static Map<K, V> |
collectEntries(Iterable<E> self, Map<K, V> collector, Closure<?> transform) Iterates through this Iterable transforming each item using the closure as a transformer into a map entry, returning the supplied map with all of the transformed entries added to it. |
<K, V> |
static Map<K, V> |
collectEntries(Collection<?> self, Map<K, V> collector) @deprecated Use the Iterable version of collectEntries instead |
<K, V> |
static Map<K, V> |
collectEntries(Iterator<?> self, Map<K, V> collector) A variant of collectEntries for Iterators using the identity closure as the transform and a supplied map as the destination of transformed entries. |
<K, V> |
static Map<K, V> |
collectEntries(Iterable<?> self, Map<K, V> collector) A variant of collectEntries for Iterables using the identity closure as the transform and a supplied map as the destination of transformed entries. |
<K, V, E> |
static Map<K, V> |
collectEntries(E[] self, Map<K, V> collector, Closure<?> transform) Iterates through this array transforming each item using the transform closure
and returning a map of the resulting transformed entries.
|
<K, V, E> |
static Map<K, V> |
collectEntries(E[] self, Map<K, V> collector) A variant of collectEntries using the identity closure as the transform. |
<K, V, E> |
static Map<K, V> |
collectEntries(E[] self, Closure<?> transform) Iterates through this array transforming each item using the transform closure
and returning a map of the resulting transformed entries.
|
<K, V, E> |
static Map<K, V> |
collectEntries(E[] self) A variant of collectEntries using the identity closure as the transform. |
<T, E> |
static List<T> |
collectMany(Collection<E> self, Closure<Collection<? extends T>> projection) @deprecated Use the Iterable version of collectMany instead |
<T, E> |
static Collection<T> |
collectMany(Collection<E> self, Collection<T> collector, Closure<Collection<? extends T>> projection) @deprecated Use the Iterable version of collectMany instead |
<T, E> |
static List<T> |
collectMany(Iterable<E> self, Closure<Collection<? extends T>> projection) Projects each item from a source Iterable to a collection and concatenates (flattens) the resulting collections into a single list. |
<T, E> |
static Collection<T> |
collectMany(Iterable<E> self, Collection<T> collector, Closure<Collection<? extends T>> projection) Projects each item from a source collection to a result collection and concatenates (flattens) the resulting collections adding them into the collector . |
<T, K, V> |
static Collection<T> |
collectMany(Map<K, V> self, Collection<T> collector, Closure<Collection<? extends T>> projection) Projects each item from a source map to a result collection and concatenates (flattens) the resulting collections adding them into the collector . |
<T, K, V> |
static Collection<T> |
collectMany(Map<K, V> self, Closure<Collection<? extends T>> projection) Projects each item from a source map to a result collection and concatenates (flattens) the resulting collections adding them into a collection. |
<T, E> |
static List<T> |
collectMany(E[] self, Closure<Collection<? extends T>> projection) Projects each item from a source array to a collection and concatenates (flattens) the resulting collections into a single list. |
<T, E> |
static List<T> |
collectMany(Iterator<E> self, Closure<Collection<? extends T>> projection) Projects each item from a source iterator to a collection and concatenates (flattens) the resulting collections into a single list. |
|
static List |
collectNested(Collection self, Closure transform) Recursively iterates through this collection transforming each non-Collection value into a new value using the closure as a transformer. |
|
static List |
collectNested(Iterable self, Closure transform) Recursively iterates through this Iterable transforming each non-Collection value into a new value using the closure as a transformer. |
|
static Collection |
collectNested(Collection self, Collection collector, Closure transform) @deprecated Use the Iterable version of collectNested instead |
|
static Collection |
collectNested(Iterable self, Collection collector, Closure transform) Recursively iterates through this Iterable transforming each non-Collection value into a new value using the transform closure. |
|
static List |
combinations(Collection self) @deprecated Use the Iterable version of combinations instead |
|
static List |
combinations(Iterable self) Adds GroovyCollections#combinations(Iterable) as a method on Iterables. |
|
static List |
combinations(Iterable self, Closure<?> function) Adds GroovyCollections#combinations(Iterable, Closure) as a method on collections. |
|
static int |
compareTo(Character left, Number right) Compare a Character and a Number. |
|
static int |
compareTo(Number left, Character right) Compare a Number and a Character. |
|
static int |
compareTo(Character left, Character right) Compare two Characters. |
|
static int |
compareTo(Number left, Number right) Compare two Numbers. |
|
static boolean |
contains(Iterable self, Object item) Returns true if this iterable contains the item. |
|
static boolean |
contains(int[] self, Object value) Checks whether the array contains the given value. |
|
static boolean |
contains(long[] self, Object value) Checks whether the array contains the given value. |
|
static boolean |
contains(short[] self, Object value) Checks whether the array contains the given value. |
|
static boolean |
contains(char[] self, Object value) Checks whether the array contains the given value. |
|
static boolean |
contains(boolean[] self, Object value) Checks whether the array contains the given value. |
|
static boolean |
contains(double[] self, Object value) Checks whether the array contains the given value. |
|
static boolean |
contains(float[] self, Object value) Checks whether the array contains the given value. |
|
static boolean |
contains(byte[] self, Object value) Checks whether the array contains the given value. |
|
static boolean |
contains(Object[] self, Object value) Checks whether the array contains the given value. |
|
static boolean |
contains(CharSequence self, CharSequence text) |
|
static boolean |
contains(String self, String text) |
|
static boolean |
containsAll(Iterable self, Object[] items) Returns true if this iterable contains all of the elements in the specified array. |
|
static boolean |
containsAll(Collection self, Object[] items) @deprecated use the Iterable variant instead |
|
static Number |
count(Iterator self, Object value) Counts the number of occurrences of the given value from the items within this Iterator. |
<T> |
static Number |
count(Iterator<T> self, Closure closure) Counts the number of occurrences which satisfy the given closure from the items within this Iterator. |
|
static Number |
count(Collection self, Object value) @deprecated use count(Iterable, Closure) |
|
static Number |
count(Iterable self, Object value) Counts the number of occurrences of the given value inside this Iterable. |
|
static Number |
count(Collection self, Closure closure) @deprecated use count(Iterable, Closure) |
<T> |
static Number |
count(Iterable<T> self, Closure closure) Counts the number of occurrences which satisfy the given closure from inside this Iterable. |
<K, V> |
static Number |
count(Map<K, V> self, Closure<?> closure) Counts the number of occurrences which satisfy the given closure from inside this map. |
|
static Number |
count(Object[] self, Object value) Counts the number of occurrences of the given value inside this array. |
<T> |
static Number |
count(T[] self, Closure closure) Counts the number of occurrences which satisfy the given closure from inside this array. |
|
static Number |
count(int[] self, Object value) Counts the number of occurrences of the given value inside this array. |
|
static Number |
count(long[] self, Object value) Counts the number of occurrences of the given value inside this array. |
|
static Number |
count(short[] self, Object value) Counts the number of occurrences of the given value inside this array. |
|
static Number |
count(char[] self, Object value) Counts the number of occurrences of the given value inside this array. |
|
static Number |
count(boolean[] self, Object value) Counts the number of occurrences of the given value inside this array. |
|
static Number |
count(double[] self, Object value) Counts the number of occurrences of the given value inside this array. |
|
static Number |
count(float[] self, Object value) Counts the number of occurrences of the given value inside this array. |
|
static Number |
count(byte[] self, Object value) Counts the number of occurrences of the given value inside this array. |
|
static int |
count(CharSequence self, CharSequence text) |
|
static int |
count(String self, String text) |
<K> |
static Map<K, Integer> |
countBy(Collection self, Closure<K> closure) @deprecated Use the Iterable version of countBy instead |
<K, E> |
static Map<K, Integer> |
countBy(Iterable<E> self, Closure<K> closure) Sorts all collection members into groups determined by the supplied mapping closure and counts the group size. |
<K, E> |
static Map<K, Integer> |
countBy(E[] self, Closure<K> closure) Sorts all array members into groups determined by the supplied mapping closure and counts the group size. |
<K, E> |
static Map<K, Integer> |
countBy(Iterator<E> self, Closure<K> closure) Sorts all iterator items into groups determined by the supplied mapping closure and counts the group size. |
<K, U, V> |
static Map<K, Integer> |
countBy(Map<U, V> self, Closure<K> closure) Groups the members of a map into groups determined by the supplied mapping closure and counts the frequency of the created groups. |
|
protected static StringBufferWriter |
createStringBufferWriter(StringBuffer self) |
|
protected static StringWriter |
createStringWriter(String self) |
|
static boolean |
deleteDir(File self) |
|
static CharSequence |
denormalize(CharSequence self) |
|
static String |
denormalize(String self) |
|
static boolean |
disjoint(Iterable left, Iterable right) Returns true if the intersection of two iterables is empty.
|
|
static boolean |
disjoint(Collection left, Collection right) @deprecated use the Iterable variant instead |
|
static Number |
div(Character left, Number right) Divide a Character by a Number. |
|
static Number |
div(Number left, Character right) Divide a Number by a Character. |
|
static Number |
div(Character left, Character right) Divide one Character by another. |
|
static void |
downto(Number self, Number to, Closure closure) Iterates from this number down to the given number, inclusive, decrementing by one each time. |
|
static void |
downto(long self, Number to, Closure closure) Iterates from this number down to the given number, inclusive, decrementing by one each time. |
|
static void |
downto(Long self, Number to, Closure closure) Iterates from this number down to the given number, inclusive, decrementing by one each time. |
|
static void |
downto(float self, Number to, Closure closure) Iterates from this number down to the given number, inclusive, decrementing by one each time. |
|
static void |
downto(Float self, Number to, Closure closure) Iterates from this number down to the given number, inclusive, decrementing by one each time. |
|
static void |
downto(double self, Number to, Closure closure) Iterates from this number down to the given number, inclusive, decrementing by one each time. |
|
static void |
downto(Double self, Number to, Closure closure) Iterates from this number down to the given number, inclusive, decrementing by one each time. |
|
static void |
downto(BigInteger self, Number to, Closure closure) Iterates from this number down to the given number, inclusive, decrementing by one each time. |
|
static void |
downto(BigDecimal self, Number to, Closure closure) Iterates from this number down to the given number, inclusive, decrementing by one each time. |
<T> |
static SortedSet<T> |
drop(SortedSet<T> self, int num) Drops the given number of elements from the head of this List. |
<T> |
static List<T> |
drop(List<T> self, int num) Drops the given number of elements from the head of this List. |
<T> |
static Collection<T> |
drop(Iterable<T> self, int num) Drops the given number of elements from the head of this Iterable. |
<T> |
static T[] |
drop(T[] self, int num) Drops the given number of elements from the head of this array if they are available. |
<K, V> |
static Map<K, V> |
drop(Map<K, V> self, int num) Drops the given number of key/value pairs from the head of this map if they are available. |
<T> |
static Iterator<T> |
drop(Iterator<T> self, int num) Drops the given number of elements from the head of this iterator if they are available. |
|
static CharSequence |
drop(CharSequence self, int num) |
<T> |
static SortedSet<T> |
dropRight(SortedSet<T> self, int num) Drops the given number of elements from the tail of this SortedSet. |
<T> |
static List<T> |
dropRight(List<T> self, int num) Drops the given number of elements from the tail of this List. |
<T> |
static Collection<T> |
dropRight(Iterable<T> self, int num) Drops the given number of elements from the tail of this Iterable. |
<T> |
static Iterator<T> |
dropRight(Iterator<T> self, int num) Drops the given number of elements from the tail of this Iterator. |
<T> |
static T[] |
dropRight(T[] self, int num) Drops the given number of elements from the tail of this array if they are available. |
<T> |
static SortedSet<T> |
dropWhile(SortedSet<T> self, Closure<?> condition) Returns a suffix of this SortedSet where elements are dropped from the front while the given Closure evaluates to true. |
<T> |
static List<T> |
dropWhile(List<T> self, Closure<?> condition) Returns a suffix of this List where elements are dropped from the front while the given Closure evaluates to true. |
<T> |
static Collection<T> |
dropWhile(Iterable<T> self, Closure<?> condition) Returns a suffix of this Iterable where elements are dropped from the front while the given closure evaluates to true. |
<K, V> |
static Map<K, V> |
dropWhile(Map<K, V> self, Closure<?> condition) Create a suffix of the given Map by dropping as many entries as possible from the front of the original Map such that calling the given closure condition evaluates to true when passed each of the dropped entries (or key/value pairs). |
<T> |
static T[] |
dropWhile(T[] self, Closure<?> condition) Create a suffix of the given array by dropping as many elements as possible from the front of the original array such that calling the given closure condition evaluates to true when passed each of the dropped elements. |
<T> |
static Iterator<T> |
dropWhile(Iterator<T> self, Closure<?> condition) Creates an Iterator that returns a suffix of the elements from an original Iterator. |
|
static String |
dump(Object self) Generates a detailed dump string of an object showing its class, hashCode and fields. |
<T> |
static T |
each(T self, Closure closure) Iterates through an aggregate type or data structure, passing each item to the given closure. |
<T> |
static Iterable<T> |
each(Iterable<T> self, Closure closure) Iterates through an Iterable, passing each item to the given closure. |
<T> |
static Iterator<T> |
each(Iterator<T> self, Closure closure) Iterates through an Iterator, passing each item to the given closure. |
<T> |
static Collection<T> |
each(Collection<T> self, Closure closure) Iterates through an Collection, passing each item to the given closure. |
<T> |
static List<T> |
each(List<T> self, Closure closure) Iterates through a List, passing each item to the given closure. |
<T> |
static Set<T> |
each(Set<T> self, Closure closure) Iterates through a Set, passing each item to the given closure. |
<T> |
static SortedSet<T> |
each(SortedSet<T> self, Closure closure) Iterates through a SortedSet, passing each item to the given closure. |
<K, V> |
static Map<K, V> |
each(Map<K, V> self, Closure closure) Allows a Map to be iterated through using a closure. |
|
static void |
eachByte(Byte[] self, Closure closure) Traverse through each byte of this Byte array. |
|
static void |
eachByte(byte[] self, Closure closure) Traverse through each byte of this byte array. |
|
static void |
eachByte(File self, Closure closure) |
|
static void |
eachByte(File self, int bufferLen, Closure closure) |
|
static void |
eachByte(InputStream is, Closure closure) |
|
static void |
eachByte(InputStream is, int bufferLen, Closure closure) |
|
static void |
eachByte(URL url, Closure closure) |
|
static void |
eachByte(URL url, int bufferLen, Closure closure) |
|
static void |
eachCombination(Iterable self, Closure<?> function) Applies a function on each combination of the input lists. |
|
static void |
eachDir(File self, Closure closure) |
|
static void |
eachDirMatch(File self, Object nameFilter, Closure closure) |
|
static void |
eachDirRecurse(File self, Closure closure) |
|
static void |
eachFile(File self, FileType fileType, Closure closure) |
|
static void |
eachFile(File self, Closure closure) |
|
static void |
eachFileMatch(File self, FileType fileType, Object nameFilter, Closure closure) |
|
static void |
eachFileMatch(File self, Object nameFilter, Closure closure) |
|
static void |
eachFileRecurse(File self, FileType fileType, Closure closure) |
|
static void |
eachFileRecurse(File self, Closure closure) |
<T> |
static T |
eachLine(CharSequence self, Closure<T> closure) |
<T> |
static T |
eachLine(CharSequence self, int firstLine, Closure<T> closure) |
<T> |
static T |
eachLine(String self, Closure<T> closure) |
<T> |
static T |
eachLine(String self, int firstLine, Closure<T> closure) |
<T> |
static T |
eachLine(File self, Closure<T> closure) |
<T> |
static T |
eachLine(File self, String charset, Closure<T> closure) |
<T> |
static T |
eachLine(File self, int firstLine, Closure<T> closure) |
<T> |
static T |
eachLine(File self, String charset, int firstLine, Closure<T> closure) |
<T> |
static T |
eachLine(InputStream stream, String charset, Closure<T> closure) |
<T> |
static T |
eachLine(InputStream stream, String charset, int firstLine, Closure<T> closure) |
<T> |
static T |
eachLine(InputStream stream, Closure<T> closure) |
<T> |
static T |
eachLine(InputStream stream, int firstLine, Closure<T> closure) |
<T> |
static T |
eachLine(URL url, Closure<T> closure) |
<T> |
static T |
eachLine(URL url, int firstLine, Closure<T> closure) |
<T> |
static T |
eachLine(URL url, String charset, Closure<T> closure) |
<T> |
static T |
eachLine(URL url, String charset, int firstLine, Closure<T> closure) |
<T> |
static T |
eachLine(Reader self, Closure<T> closure) |
<T> |
static T |
eachLine(Reader self, int firstLine, Closure<T> closure) |
|
static String |
eachMatch(CharSequence self, CharSequence regex, Closure closure) |
|
static String |
eachMatch(CharSequence self, Pattern pattern, Closure closure) |
|
static String |
eachMatch(String self, Pattern pattern, Closure closure) |
|
static String |
eachMatch(String self, String regex, Closure closure) |
|
static void |
eachObject(File self, Closure closure) |
|
static void |
eachObject(ObjectInputStream ois, Closure closure) |
<T> |
static Iterator<List<T>> |
eachPermutation(Collection<T> self, Closure closure) @deprecated Use the Iterable version of eachPermutation instead |
<T> |
static Iterator<List<T>> |
eachPermutation(Iterable<T> self, Closure closure) Iterates over all permutations of a collection, running a closure for each iteration. |
<T> |
static T |
eachWithIndex(T self, Closure closure) Iterates through an aggregate type or data structure, passing each item and the item's index (a counter starting at zero) to the given closure. |
<T> |
static Iterable<T> |
eachWithIndex(Iterable<T> self, Closure closure) Iterates through an iterable type, passing each item and the item's index (a counter starting at zero) to the given closure. |
<T> |
static Iterator<T> |
eachWithIndex(Iterator<T> self, Closure closure) Iterates through an iterator type, passing each item and the item's index (a counter starting at zero) to the given closure. |
<T> |
static Collection<T> |
eachWithIndex(Collection<T> self, Closure closure) Iterates through an Collection, passing each item and the item's index (a counter starting at zero) to the given closure. |
<T> |
static List<T> |
eachWithIndex(List<T> self, Closure closure) Iterates through a List, passing each item and the item's index (a counter starting at zero) to the given closure. |
<T> |
static Set<T> |
eachWithIndex(Set<T> self, Closure closure) Iterates through a Set, passing each item and the item's index (a counter starting at zero) to the given closure. |
<T> |
static SortedSet<T> |
eachWithIndex(SortedSet<T> self, Closure closure) Iterates through a SortedSet, passing each item and the item's index (a counter starting at zero) to the given closure. |
<K, V> |
static Map<K, V> |
eachWithIndex(Map<K, V> self, Closure closure) Allows a Map to be iterated through using a closure. |
|
static boolean |
equals(int[] left, int[] right) Compare the contents of this array to the contents of the given array. |
|
static boolean |
equals(Object[] left, List right) Determines if the contents of this array are equal to the contents of the given list, in the same order. |
|
static boolean |
equals(List left, Object[] right) Determines if the contents of this list are equal to the contents of the given array in the same order. |
|
static boolean |
equals(List left, List right) Compare the contents of two Lists. |
<T> |
static boolean |
equals(Set<T> self, Set<T> other) Compare the contents of two Sets for equality using Groovy's coercion rules. |
|
static boolean |
equals(Map self, Map other) Compares two Maps treating coerced numerical values as identical. |
|
static boolean |
every(Object self, Closure closure) Used to determine if the given predicate closure is valid (i.e. returns true for all items in this data structure).
|
<T> |
static boolean |
every(Iterator<T> self, Closure closure) Used to determine if the given predicate closure is valid (i.e. returns true for all items in this iterator).
|
<T> |
static boolean |
every(Iterable<T> self, Closure closure) Used to determine if the given predicate closure is valid (i.e. returns true for all items in this iterable).
|
<K, V> |
static boolean |
every(Map<K, V> self, Closure closure) Iterates over the entries of a map, and checks whether a predicate is valid for all entries. |
|
static boolean |
every(Object self) Iterates over every element of a collection, and checks whether all elements are true according to the Groovy Truth.
|
|
static Process |
execute(String self) |
|
static Process |
execute(String self, String[] envp, File dir) |
|
static Process |
execute(String self, List envp, File dir) |
|
static Process |
execute(String[] commandArray) |
|
static Process |
execute(String[] commandArray, String[] envp, File dir) |
|
static Process |
execute(String[] commandArray, List envp, File dir) |
|
static Process |
execute(List commands) |
|
static Process |
execute(List commands, String[] envp, File dir) |
|
static Process |
execute(List commands, List envp, File dir) |
|
static CharSequence |
expand(CharSequence self) |
|
static CharSequence |
expand(CharSequence self, int tabStop) |
|
static String |
expand(String self) |
|
static String |
expand(String self, int tabStop) |
|
static CharSequence |
expandLine(CharSequence self, int tabStop) |
|
static String |
expandLine(String self, int tabStop) |
|
static void |
filterLine(Reader reader, Writer writer, Closure closure) |
|
static Writable |
filterLine(File self, Closure closure) |
|
static Writable |
filterLine(File self, String charset, Closure closure) |
|
static void |
filterLine(File self, Writer writer, Closure closure) |
|
static void |
filterLine(File self, Writer writer, String charset, Closure closure) |
|
static Writable |
filterLine(Reader reader, Closure closure) |
|
static Writable |
filterLine(InputStream self, Closure predicate) |
|
static Writable |
filterLine(InputStream self, String charset, Closure predicate) |
|
static void |
filterLine(InputStream self, Writer writer, Closure predicate) |
|
static void |
filterLine(InputStream self, Writer writer, String charset, Closure predicate) |
|
static Writable |
filterLine(URL self, Closure predicate) |
|
static Writable |
filterLine(URL self, String charset, Closure predicate) |
|
static void |
filterLine(URL self, Writer writer, Closure predicate) |
|
static void |
filterLine(URL self, Writer writer, String charset, Closure predicate) |
|
static Object |
find(Object self, Closure closure) Finds the first value matching the closure condition. |
|
static Object |
find(Object self) Finds the first item matching the IDENTITY Closure (i.e. matching Groovy truth). |
<T> |
static T |
find(Collection<T> self, Closure closure) Finds the first value matching the closure condition. |
<T> |
static T |
find(T[] self, Closure condition) Finds the first element in the array that matches the given closure condition. |
<T> |
static T |
find(Collection<T> self) Finds the first item matching the IDENTITY Closure (i.e. matching Groovy truth). |
<K, V> |
static Map.Entry<K, V> |
find(Map<K, V> self, Closure<?> closure) Finds the first entry matching the closure condition. |
|
static CharSequence |
find(CharSequence self, CharSequence regex) |
|
static CharSequence |
find(CharSequence self, CharSequence regex, Closure closure) |
|
static CharSequence |
find(CharSequence self, Pattern pattern) |
|
static CharSequence |
find(CharSequence self, Pattern pattern, Closure closure) |
|
static String |
find(String self, Pattern pattern) |
|
static String |
find(String self, Pattern pattern, Closure closure) |
|
static String |
find(String self, String regex) |
|
static String |
find(String self, String regex, Closure closure) |
<T> |
static Set<T> |
findAll(Set<T> self, Closure closure) Finds all values matching the closure condition. |
<T> |
static List<T> |
findAll(List<T> self, Closure closure) Finds all values matching the closure condition. |
<T> |
static Collection<T> |
findAll(Collection<T> self, Closure closure) Finds all values matching the closure condition. |
<T> |
static Collection<T> |
findAll(T[] self, Closure condition) Finds all elements of the array matching the given Closure condition. |
<T> |
static Set<T> |
findAll(Set<T> self) Finds the items matching the IDENTITY Closure (i.e. matching Groovy truth). |
<T> |
static List<T> |
findAll(List<T> self) Finds the items matching the IDENTITY Closure (i.e. matching Groovy truth). |
<T> |
static Collection<T> |
findAll(Collection<T> self) Finds the items matching the IDENTITY Closure (i.e. matching Groovy truth). |
<T> |
static Collection<T> |
findAll(T[] self) Finds the elements of the array matching the IDENTITY Closure (i.e. matching Groovy truth). |
|
static Collection |
findAll(Object self, Closure closure) Finds all items matching the closure condition. |
|
static Collection |
findAll(Object self) Finds all items matching the IDENTITY Closure (i.e. matching Groovy truth). |
<K, V> |
static Map<K, V> |
findAll(Map<K, V> self, Closure closure) Finds all entries matching the closure condition. |
|
static List<String> |
findAll(CharSequence self, CharSequence regex) |
<T> |
static List<T> |
findAll(CharSequence self, CharSequence regex, Closure<T> closure) |
|
static List<String> |
findAll(CharSequence self, Pattern pattern) |
<T> |
static List<T> |
findAll(CharSequence self, Pattern pattern, Closure<T> closure) |
|
static List<String> |
findAll(String self, Pattern pattern) |
<T> |
static List<T> |
findAll(String self, Pattern pattern, Closure<T> closure) |
|
static List<String> |
findAll(String self, String regex) |
<T> |
static List<T> |
findAll(String self, String regex, Closure<T> closure) |
|
static int |
findIndexOf(Object self, Closure closure) Iterates over the elements of an iterable collection of items and returns the index of the first item that matches the condition specified in the closure. |
|
static int |
findIndexOf(Object self, int startIndex, Closure closure) Iterates over the elements of an iterable collection of items, starting from a specified startIndex, and returns the index of the first item that matches the condition specified in the closure. |
|
static List<Number> |
findIndexValues(Object self, Closure closure) Iterates over the elements of an iterable collection of items and returns the index values of the items that match the condition specified in the closure. |
|
static List<Number> |
findIndexValues(Object self, Number startIndex, Closure closure) Iterates over the elements of an iterable collection of items, starting from a specified startIndex, and returns the index values of the items that match the condition specified in the closure. |
|
static int |
findLastIndexOf(Object self, Closure closure) Iterates over the elements of an iterable collection of items and returns the index of the last item that matches the condition specified in the closure. |
|
static int |
findLastIndexOf(Object self, int startIndex, Closure closure) Iterates over the elements of an iterable collection of items, starting from a specified startIndex, and returns the index of the last item that matches the condition specified in the closure. |
|
static Object |
findResult(Object self, Object defaultResult, Closure closure) Treats the object as iterable, iterating through the values it represents and returns the first non-null result obtained from calling the closure, otherwise returns the defaultResult. |
|
static Object |
findResult(Object self, Closure closure) Treats the object as iterable, iterating through the values it represents and returns the first non-null result obtained from calling the closure, otherwise returns null. |
<T, U extends T, V extends T, E> |
static T |
findResult(Collection<E> self, U defaultResult, Closure<V> closure) Iterates through the collection calling the given closure for each item but stopping once the first non-null result is found and returning that result. |
<T, U> |
static T |
findResult(Collection<U> self, Closure<T> closure) Iterates through the collection calling the given closure for each item but stopping once the first non-null result is found and returning that result. |
<T, U extends T, V extends T, A, B> |
static T |
findResult(Map<A, B> self, U defaultResult, Closure<V> closure) Returns the first non-null closure result found by passing each map entry to the closure, otherwise the defaultResult is returned. |
<T, K, V> |
static T |
findResult(Map<K, V> self, Closure<T> closure) Returns the first non-null closure result found by passing each map entry to the closure, otherwise null is returned. |
<T, U> |
static Collection<T> |
findResults(Collection<U> self, Closure<T> filteringTransform) @deprecated Use the Iterable version of findResults instead |
<T, U> |
static Collection<T> |
findResults(Iterable<U> self, Closure<T> filteringTransform) Iterates through the Iterable transforming items using the supplied closure and collecting any non-null results. |
<T, K, V> |
static Collection<T> |
findResults(Map<K, V> self, Closure<T> filteringTransform) Iterates through the map transforming items using the supplied closure and collecting any non-null results. |
<T> |
static T |
first(List<T> self) Returns the first item from the List. |
<T> |
static T |
first(Iterable<T> self) Returns the first item from the Iterable. |
<T> |
static T |
first(T[] self) Returns the first item from the array. |
|
static Collection<?> |
flatten(Collection<?> self) Flatten a Collection. |
|
static Collection<?> |
flatten(Iterable<?> self) Flatten an Iterable. |
|
static List<?> |
flatten(List<?> self) Flatten a List. |
|
static Set<?> |
flatten(Set<?> self) Flatten a Set. |
|
static SortedSet<?> |
flatten(SortedSet<?> self) Flatten a SortedSet. |
|
static Collection |
flatten(Object[] self) Flatten an array. |
|
static Collection |
flatten(boolean[] self) Flatten an array. |
|
static Collection |
flatten(byte[] self) Flatten an array. |
|
static Collection |
flatten(char[] self) Flatten an array. |
|
static Collection |
flatten(short[] self) Flatten an array. |
|
static Collection |
flatten(int[] self) Flatten an array. |
|
static Collection |
flatten(long[] self) Flatten an array. |
|
static Collection |
flatten(float[] self) Flatten an array. |
|
static Collection |
flatten(double[] self) Flatten an array. |
<T> |
static Collection<T> |
flatten(Collection<T> self, Closure<? extends T> flattenUsing) @deprecated Use the Iterable version of flatten instead |
<T> |
static Collection<T> |
flatten(Iterable<T> self, Closure<? extends T> flattenUsing) Flatten an Iterable. |
<K, V> |
static V |
get(Map<K, V> map, K key, V defaultValue) Looks up an item in a Map for the given key and returns the value - unless there is no entry for the given key in which case add the default value to the map and return that. |
|
static Object |
getAt(Object self, String property) Allows the subscript operator to be used to lookup dynamic property values. |
<T> |
static List<T> |
getAt(List<T> self, Range range) Support the range subscript operator for a List. |
<T> |
static List<T> |
getAt(ListWithDefault<T> self, Collection indices) Select a List of items from an eager or lazy List using a Collection to identify the indices to be selected. |
<T> |
static List<T> |
getAt(ListWithDefault<T> self, Range range) Support the range subscript operator for an eager or lazy List. |
<T> |
static List<T> |
getAt(ListWithDefault<T> self, EmptyRange range) Support the range subscript operator for an eager or lazy List. |
<T> |
static List<T> |
getAt(List<T> self, EmptyRange range) Support the range subscript operator for a List. |
<T> |
static List<T> |
getAt(List<T> self, Collection indices) Select a List of items from a List using a Collection to identify the indices to be selected. |
<T> |
static List<T> |
getAt(T[] self, Collection indices) Select a List of items from an array using a Collection to identify the indices to be selected. |
<T> |
static List<T> |
getAt(T[] array, Range range) Support the range subscript operator for an Array |
<T> |
static List<T> |
getAt(T[] array, IntRange range) @param array an Array of Objects |
<T> |
static List<T> |
getAt(T[] array, EmptyRange range) @param array an Array of Objects |
<T> |
static List<T> |
getAt(T[] array, ObjectRange range) @param array an Array of Objects |
<T> |
static T |
getAt(List<T> self, int idx) Support the subscript operator for a List. |
<T> |
static T |
getAt(Iterator<T> self, int idx) Support the subscript operator for an Iterator. |
<T> |
static T |
getAt(Iterable<T> self, int idx) Support the subscript operator for an Iterable. |
<K, V> |
static V |
getAt(Map<K, V> self, K key) Support the subscript operator for a Map. |
|
static List |
getAt(Collection coll, String property) Support the subscript operator for Collection. |
|
static List<Byte> |
getAt(byte[] array, Range range) Support the subscript operator with a range for a byte array |
|
static List<Character> |
getAt(char[] array, Range range) Support the subscript operator with a range for a char array |
|
static List<Short> |
getAt(short[] array, Range range) Support the subscript operator with a range for a short array |
|
static List<Integer> |
getAt(int[] array, Range range) Support the subscript operator with a range for an int array |
|
static List<Long> |
getAt(long[] array, Range range) Support the subscript operator with a range for a long array |
|
static List<Float> |
getAt(float[] array, Range range) Support the subscript operator with a range for a float array |
|
static List<Double> |
getAt(double[] array, Range range) Support the subscript operator with a range for a double array |
|
static List<Boolean> |
getAt(boolean[] array, Range range) Support the subscript operator with a range for a boolean array |
|
static List<Byte> |
getAt(byte[] array, IntRange range) Support the subscript operator with an IntRange for a byte array |
|
static List<Character> |
getAt(char[] array, IntRange range) Support the subscript operator with an IntRange for a char array |
|
static List<Short> |
getAt(short[] array, IntRange range) Support the subscript operator with an IntRange for a short array |
|
static List<Integer> |
getAt(int[] array, IntRange range) Support the subscript operator with an IntRange for an int array |
|
static List<Long> |
getAt(long[] array, IntRange range) Support the subscript operator with an IntRange for a long array |
|
static List<Float> |
getAt(float[] array, IntRange range) Support the subscript operator with an IntRange for a float array |
|
static List<Double> |
getAt(double[] array, IntRange range) Support the subscript operator with an IntRange for a double array |
|
static List<Boolean> |
getAt(boolean[] array, IntRange range) Support the subscript operator with an IntRange for a boolean array |
|
static List<Byte> |
getAt(byte[] array, ObjectRange range) Support the subscript operator with an ObjectRange for a byte array |
|
static List<Character> |
getAt(char[] array, ObjectRange range) Support the subscript operator with an ObjectRange for a char array |
|
static List<Short> |
getAt(short[] array, ObjectRange range) Support the subscript operator with an ObjectRange for a short array |
|
static List<Integer> |
getAt(int[] array, ObjectRange range) Support the subscript operator with an ObjectRange for an int array |
|
static List<Long> |
getAt(long[] array, ObjectRange range) Support the subscript operator with an ObjectRange for a long array |
|
static List<Float> |
getAt(float[] array, ObjectRange range) Support the subscript operator with an ObjectRange for a float array |
|
static List<Double> |
getAt(double[] array, ObjectRange range) Support the subscript operator with an ObjectRange for a double array |
|
static List<Boolean> |
getAt(boolean[] array, ObjectRange range) Support the subscript operator with an ObjectRange for a byte array |
|
static List<Byte> |
getAt(byte[] array, Collection indices) Support the subscript operator with a collection for a byte array |
|
static List<Character> |
getAt(char[] array, Collection indices) Support the subscript operator with a collection for a char array |
|
static List<Short> |
getAt(short[] array, Collection indices) Support the subscript operator with a collection for a short array |
|
static List<Integer> |
getAt(int[] array, Collection indices) Support the subscript operator with a collection for an int array |
|
static List<Long> |
getAt(long[] array, Collection indices) Support the subscript operator with a collection for a long array |
|
static List<Float> |
getAt(float[] array, Collection indices) Support the subscript operator with a collection for a float array |
|
static List<Double> |
getAt(double[] array, Collection indices) Support the subscript operator with a collection for a double array |
|
static List<Boolean> |
getAt(boolean[] array, Collection indices) Support the subscript operator with a collection for a boolean array |
|
static boolean |
getAt(BitSet self, int index) Support the subscript operator for a Bitset |
|
static BitSet |
getAt(BitSet self, IntRange range) Support retrieving a subset of a BitSet using a Range |
|
static CharSequence |
getAt(CharSequence self, Collection indices) |
|
static CharSequence |
getAt(CharSequence text, EmptyRange range) |
|
static CharSequence |
getAt(CharSequence text, int index) |
|
static CharSequence |
getAt(CharSequence text, IntRange range) |
|
static CharSequence |
getAt(CharSequence text, Range range) |
|
static List |
getAt(Matcher self, Collection indices) |
|
static Object |
getAt(Matcher matcher, int idx) |
|
static String |
getAt(String self, Collection indices) |
|
static String |
getAt(String text, EmptyRange range) |
|
static String |
getAt(String text, int index) |
|
static String |
getAt(String text, IntRange range) |
|
static String |
getAt(String text, Range range) |
|
static byte[] |
getBytes(File file) |
|
static byte[] |
getBytes(URL url) |
|
static byte[] |
getBytes(InputStream is) |
|
static char[] |
getChars(CharSequence self) |
|
static char[] |
getChars(String self) |
|
static int |
getCount(Matcher matcher) |
|
static IntRange |
getIndices(Collection self) Returns indices of the collection. |
<T> |
static IntRange |
getIndices(T[] self) Returns indices of the array. |
|
static MetaClass |
getMetaClass(Class c) Adds a "metaClass" property to all class objects so you can use the syntax String.metaClass.myMethod = { println "foo" } |
|
static MetaClass |
getMetaClass(Object obj) Obtains a MetaClass for an object either from the registry or in the case of a GroovyObject from the object itself. |
|
static MetaClass |
getMetaClass(GroovyObject obj) Obtains a MetaClass for an object either from the registry or in the case of a GroovyObject from the object itself. |
|
static List<PropertyValue> |
getMetaPropertyValues(Object self) Retrieves the list of MetaProperty objects for 'self' and wraps it in a list of PropertyValue objects that additionally provide the value for each property of 'self'. |
|
static Map |
getProperties(Object self) Convenience method that calls getMetaPropertyValues(java.lang.Object)(self) and provides the data in form of simple key/value pairs, i.e. without type() information. |
|
static ClassLoader |
getRootLoader(ClassLoader self) Iterates through the classloader parents until it finds a loader with a class named "org.codehaus.groovy.tools.RootLoader". |
|
protected static List |
getSubList(List self, List splice) |
|
static String |
getText(File file, String charset) |
|
static String |
getText(File file) |
|
static String |
getText(URL url) |
|
static String |
getText(URL url, Map parameters) |
|
static String |
getText(URL url, String charset) |
|
static String |
getText(URL url, Map parameters, String charset) |
|
static String |
getText(InputStream is) |
|
static String |
getText(InputStream is, String charset) |
|
static String |
getText(Reader reader) |
|
static String |
getText(BufferedReader reader) |
|
static Collection |
grep(Object self, Object filter) Iterates over the collection of items which this Object represents and returns each item that matches the given filter - calling the isCase(java.lang.Object, java.lang.Object)
method used by switch statements. |
<T> |
static Collection<T> |
grep(Collection<T> self, Object filter) Iterates over the collection of items and returns each item that matches the given filter - calling the isCase(java.lang.Object, java.lang.Object)
method used by switch statements. |
<T> |
static List<T> |
grep(List<T> self, Object filter) Iterates over the collection of items and returns each item that matches the given filter - calling the isCase(java.lang.Object, java.lang.Object)
method used by switch statements. |
<T> |
static Set<T> |
grep(Set<T> self, Object filter) Iterates over the collection of items and returns each item that matches the given filter - calling the isCase(java.lang.Object, java.lang.Object)
method used by switch statements. |
<T> |
static Collection<T> |
grep(T[] self, Object filter) Iterates over the array of items and returns a collection of items that match the given filter - calling the isCase(java.lang.Object, java.lang.Object)
method used by switch statements. |
|
static Collection |
grep(Object self) Iterates over the collection of items which this Object represents and returns each item that matches using the IDENTITY Closure as a filter - effectively returning all elements which satisfy Groovy truth. |
<T> |
static Collection<T> |
grep(Collection<T> self) Iterates over the collection returning each element that matches using the IDENTITY Closure as a filter - effectively returning all elements which satisfy Groovy truth. |
<T> |
static List<T> |
grep(List<T> self) Iterates over the collection returning each element that matches using the IDENTITY Closure as a filter - effectively returning all elements which satisfy Groovy truth. |
<T> |
static Set<T> |
grep(Set<T> self) Iterates over the collection returning each element that matches using the IDENTITY Closure as a filter - effectively returning all elements which satisfy Groovy truth. |
<T> |
static Collection<T> |
grep(T[] self) Iterates over the array returning each element that matches using the IDENTITY Closure as a filter - effectively returning all elements which satisfy Groovy truth. |
<K, T> |
protected static void |
groupAnswer(Map<K, List<T>> answer, T element, K value) Groups the current element according to the value |
<K, T> |
static Map<K, List<T>> |
groupBy(Collection<T> self, Closure<K> closure) @deprecated Use the Iterable version of groupBy instead |
<K, T> |
static Map<K, List<T>> |
groupBy(Iterable<T> self, Closure<K> closure) Sorts all Iterable members into groups determined by the supplied mapping closure. |
<K, T> |
static Map<K, List<T>> |
groupBy(T[] self, Closure<K> closure) Sorts all array members into groups determined by the supplied mapping closure. |
|
static Map |
groupBy(Collection self, Object... closures) @deprecated Use the Iterable version of groupBy instead |
|
static Map |
groupBy(Iterable self, Object... closures) Sorts all Iterable members into (sub)groups determined by the supplied mapping closures. |
|
static Map |
groupBy(Object[] self, Object... closures) Sorts all array members into (sub)groups determined by the supplied mapping closures as per the Iterable variant of this method. |
|
static Map |
groupBy(Collection self, List<Closure> closures) @deprecated Use the Iterable version of groupBy instead |
|
static Map |
groupBy(Iterable self, List<Closure> closures) Sorts all Iterable members into (sub)groups determined by the supplied mapping closures. |
|
static Map |
groupBy(Object[] self, List<Closure> closures) Sorts all array members into (sub)groups determined by the supplied mapping closures as per the list variant of this method. |
<G, K, V> |
static Map<G, Map<K, V>> |
groupBy(Map<K, V> self, Closure<G> closure) Groups the members of a map into sub maps determined by the supplied mapping closure. |
|
static Map<Object, Map> |
groupBy(Map self, Object... closures) Groups the members of a map into sub maps determined by the supplied mapping closures. |
|
static Map<Object, Map> |
groupBy(Map self, List<Closure> closures) Groups the members of a map into sub maps determined by the supplied mapping closures. |
<G, K, V> |
static Map<G, List<Map.Entry<K, V>>> |
groupEntriesBy(Map<K, V> self, Closure<G> closure) Groups all map entries into groups determined by the supplied mapping closure. |
|
static boolean |
hasGroup(Matcher matcher) |
|
static MetaProperty |
hasProperty(Object self, String name) |
<T> |
static T |
head(Iterable<T> self) Returns the first item from the Iterable. |
<T> |
static T |
head(List<T> self) Returns the first item from the List. |
<T> |
static T |
head(T[] self) Returns the first item from the Object array. |
<T> |
static T |
identity(Object self, Closure<T> closure) Allows the closure to be called for the object reference self. |
|
static Boolean |
implies(Boolean left, Boolean right) Logical implication of two boolean operators |
<E> |
static Map<Integer, E> |
indexed(Iterable<E> self) Zips an Iterable with indices in (index, value) order. |
<E> |
static Map<Integer, E> |
indexed(Iterable<E> self, int offset) Zips an Iterable with indices in (index, value) order. |
<E> |
static Iterator<Tuple2<Integer, E>> |
indexed(Iterator<E> self) Zips an iterator with indices in (index, value) order. |
<E> |
static Iterator<Tuple2<Integer, E>> |
indexed(Iterator<E> self, int offset) Zips an iterator with indices in (index, value) order. |
<T> |
static Collection<T> |
init(Iterable<T> self) Returns the items from the Iterable excluding the last item. |
<T> |
static List<T> |
init(List<T> self) Returns the items from the List excluding the last item. |
<T> |
static SortedSet<T> |
init(SortedSet<T> self) Returns the items from the SortedSet excluding the last item. |
<T> |
static Iterator<T> |
init(Iterator<T> self) Returns an Iterator containing all of the items from this iterator except the last one. |
<T> |
static T[] |
init(T[] self) Returns the items from the Object array excluding the last item. |
<T, V extends T> |
static T |
inject(Collection<T> self, Closure<V> closure) Performs the same function as the version of inject that takes an initial value, but uses the head of the Collection as the initial value, and iterates over the tail. |
<E, T, U extends T, V extends T> |
static T |
inject(Collection<E> self, U initialValue, Closure<V> closure) Iterates through the given Collection, passing in the initial value to the 2-arg closure along with the first item. |
<K, V, T, U extends T, W extends T> |
static T |
inject(Map<K, V> self, U initialValue, Closure<W> closure) Iterates through the given Map, passing in the initial value to the 2-arg Closure along with the first item (or 3-arg Closure along with the first key and value). |
<E, T, U extends T, V extends T> |
static T |
inject(Iterator<E> self, U initialValue, Closure<V> closure) Iterates through the given Iterator, passing in the initial value to the closure along with the first item. |
<T, V extends T> |
static T |
inject(Object self, Closure<V> closure) Iterates through the given Object, passing in the first value to the closure along with the first item. |
<T, U extends T, V extends T> |
static T |
inject(Object self, U initialValue, Closure<V> closure) Iterates through the given Object, passing in the initial value to the closure along with the first item. |
<E, T, V extends T> |
static T |
inject(E[] self, Closure<V> closure) Iterates through the given array as with inject(Object[],initialValue,closure), but using the first element of the array as the initialValue, and then iterating the remaining elements of the array. |
<E, T, U extends T, V extends T> |
static T |
inject(E[] self, U initialValue, Closure<V> closure) Iterates through the given array, passing in the initial value to the closure along with the first item. |
|
static String |
inspect(Object self) Inspects returns the String that matches what would be typed into a terminal to create this object. |
|
static Number |
intdiv(Character left, Number right) Integer Divide a Character by a Number. |
|
static Number |
intdiv(Number left, Character right) Integer Divide a Number by a Character. |
|
static Number |
intdiv(Character left, Character right) Integer Divide two Characters. |
|
static Number |
intdiv(Number left, Number right) Integer Divide two Numbers. |
<T> |
static Collection<T> |
intersect(Collection<T> left, Collection<T> right) Create a Collection composed of the intersection of both collections. |
<T> |
static Collection<T> |
intersect(Iterable<T> left, Iterable<T> right) Create a Collection composed of the intersection of both iterables. |
<T> |
static List<T> |
intersect(List<T> left, Iterable<T> right) Create a List composed of the intersection of a List and an Iterable. |
<T> |
static Set<T> |
intersect(Set<T> left, Iterable<T> right) Create a Set composed of the intersection of a Set and an Iterable. |
<T> |
static SortedSet<T> |
intersect(SortedSet<T> left, Iterable<T> right) Create a SortedSet composed of the intersection of a SortedSet and an Iterable. |
<K, V> |
static Map<K, V> |
intersect(Map<K, V> left, Map<K, V> right) Create a Map composed of the intersection of both maps. |
|
static Object |
invokeMethod(Object object, String method, Object arguments) Provide a dynamic method invocation method which can be overloaded in classes to implement dynamic proxies easily. |
|
static boolean |
is(Object self, Object other) Identity check. |
|
static boolean |
isAllWhitespace(CharSequence self) |
|
static boolean |
isAllWhitespace(String self) |
|
static boolean |
isBigDecimal(CharSequence self) |
|
static boolean |
isBigDecimal(String self) |
|
static boolean |
isBigInteger(CharSequence self) |
|
static boolean |
isBigInteger(String self) |
|
static boolean |
isCase(Object caseValue, Object switchValue) Method for overloading the behavior of the 'case' method in switch statements. |
|
static boolean |
isCase(Class caseValue, Object switchValue) Special 'Case' implementation for Class, which allows testing for a certain class in a switch statement. |
|
static boolean |
isCase(Collection caseValue, Object switchValue) 'Case' implementation for collections which tests if the 'switch' operand is contained in any of the 'case' values. |
|
static boolean |
isCase(Map caseValue, Object switchValue) 'Case' implementation for maps which tests the groovy truth value obtained using the 'switch' operand as key. |
|
static boolean |
isCase(Number caseValue, Number switchValue) Special 'case' implementation for all numbers, which delegates to the compareTo() method for comparing numbers of different
types. |
|
static boolean |
isCase(CharSequence caseValue, Object switchValue) |
|
static boolean |
isCase(GString caseValue, Object switchValue) |
|
static boolean |
isCase(Pattern caseValue, Object switchValue) |
|
static boolean |
isCase(String caseValue, Object switchValue) |
|
static boolean |
isDigit(Character self) Determines if a character is a digit. |
|
static boolean |
isDouble(CharSequence self) |
|
static boolean |
isDouble(String self) |
|
static boolean |
isFloat(CharSequence self) |
|
static boolean |
isFloat(String self) |
|
static boolean |
isInteger(CharSequence self) |
|
static boolean |
isInteger(String self) |
|
static boolean |
isLetter(Character self) Determines if a character is a letter. |
|
static boolean |
isLetterOrDigit(Character self) Determines if a character is a letter or digit. |
|
static boolean |
isLong(CharSequence self) |
|
static boolean |
isLong(String self) |
|
static boolean |
isLowerCase(Character self) Determine if a Character is lowercase. |
|
static boolean |
isNumber(CharSequence self) |
|
static boolean |
isNumber(String self) |
|
static boolean |
isUpperCase(Character self) Determine if a Character is uppercase. |
|
static boolean |
isWhitespace(Character self) Determines if a character is a whitespace character. |
<T> |
static Iterator<T> |
iterator(T[] a) Attempts to create an Iterator for the given object by first converting it to a Collection. |
|
static Iterator |
iterator(Object o) Attempts to create an Iterator for the given object by first converting it to a Collection. |
<T> |
static Iterator<T> |
iterator(Enumeration<T> enumeration) Allows an Enumeration to behave like an Iterator. |
<T> |
static Iterator<T> |
iterator(Iterator<T> self) An identity function for iterators, supporting 'duck-typing' when trying to get an iterator for each object within a collection, some of which may already be iterators. |
|
static Iterator |
iterator(Matcher matcher) |
|
static Iterator<String> |
iterator(Reader self) |
|
static Iterator<Byte> |
iterator(InputStream self) |
|
static Iterator<Byte> |
iterator(DataInputStream self) |
|
static String |
join(Iterator<Object> self, String separator) Concatenates the toString() representation of each
item from the iterator, with the given String as a separator between
each item. |
|
static String |
join(Collection self, String separator) @deprecated Use the Iterable version of join instead |
|
static String |
join(Iterable self, String separator) Concatenates the toString() representation of each
item in this Iterable, with the given String as a separator between each item.
|
|
static String |
join(Object[] self, String separator) Concatenates the toString() representation of each
items in this array, with the given String as a separator between each
item. |
|
static String |
join(boolean[] self, String separator) Concatenates the string representation of each items in this array, with the given String as a separator between each item. |
|
static String |
join(byte[] self, String separator) Concatenates the string representation of each items in this array, with the given String as a separator between each item. |
|
static String |
join(char[] self, String separator) Concatenates the string representation of each items in this array, with the given String as a separator between each item. |
|
static String |
join(double[] self, String separator) Concatenates the string representation of each items in this array, with the given String as a separator between each item. |
|
static String |
join(float[] self, String separator) Concatenates the string representation of each items in this array, with the given String as a separator between each item. |
|
static String |
join(int[] self, String separator) Concatenates the string representation of each items in this array, with the given String as a separator between each item. |
|
static String |
join(long[] self, String separator) Concatenates the string representation of each items in this array, with the given String as a separator between each item. |
|
static String |
join(short[] self, String separator) Concatenates the string representation of each items in this array, with the given String as a separator between each item. |
<T> |
static T |
last(List<T> self) Returns the last item from the List. |
<T> |
static T |
last(Iterable<T> self) Returns the last item from the Iterable. |
<T> |
static T |
last(T[] self) Returns the last item from the array. |
<T> |
static Collection<T> |
leftShift(Collection<T> self, T value) Overloads the left shift operator to provide an easy way to append objects to a Collection. |
<T> |
static List<T> |
leftShift(List<T> self, T value) Overloads the left shift operator to provide an easy way to append objects to a List. |
<T> |
static Set<T> |
leftShift(Set<T> self, T value) Overloads the left shift operator to provide an easy way to append objects to a Set. |
<T> |
static SortedSet<T> |
leftShift(SortedSet<T> self, T value) Overloads the left shift operator to provide an easy way to append objects to a SortedSet. |
<T> |
static BlockingQueue<T> |
leftShift(BlockingQueue<T> self, T value) Overloads the left shift operator to provide an easy way to append objects to a BlockingQueue. |
<K, V> |
static Map<K, V> |
leftShift(Map<K, V> self, Map.Entry<K, V> entry) Overloads the left shift operator to provide an easy way to append Map.Entry values to a Map. |
<K, V> |
static Map<K, V> |
leftShift(Map<K, V> self, Map<K, V> other) Overloads the left shift operator to provide an easy way to put one maps entries into another map. |
|
static Number |
leftShift(Number self, Number operand) Implementation of the left shift operator for integral types. |
|
static StringBuilder |
leftShift(CharSequence self, Object value) |
|
static StringBuffer |
leftShift(String self, Object value) |
|
static StringBuffer |
leftShift(StringBuffer self, Object value) |
|
static StringBuilder |
leftShift(StringBuilder self, Object value) |
|
static Writer |
leftShift(Socket self, Object value) |
|
static OutputStream |
leftShift(Socket self, byte[] value) |
|
static Writer |
leftShift(Writer self, Object value) |
|
static Writer |
leftShift(OutputStream self, Object value) |
|
static void |
leftShift(ObjectOutputStream self, Object value) |
|
static OutputStream |
leftShift(OutputStream self, InputStream in) |
|
static OutputStream |
leftShift(OutputStream self, byte[] value) |
|
static File |
leftShift(File file, Object text) |
|
static File |
leftShift(File file, byte[] bytes) |
|
static File |
leftShift(File file, InputStream data) |
|
static boolean |
matches(CharSequence self, Pattern pattern) |
|
static boolean |
matches(String self, Pattern pattern) |
<K, V> |
static Map.Entry<K, V> |
max(Map<K, V> self, Closure closure) Selects an entry in the map having the maximum calculated value as determined by the supplied closure. |
<T> |
static T |
max(Collection<T> self) @deprecated Use the Iterable version of max instead |
<T> |
static T |
max(Iterable<T> self) Adds max() method to Iterable objects. |
<T> |
static T |
max(Iterator<T> self) Adds max() method to Iterator objects. |
<T> |
static T |
max(T[] self) Adds max() method to Object arrays. |
<T> |
static T |
max(Collection<T> self, Closure closure) @deprecated Use the Iterable version of max instead |
<T> |
static T |
max(Iterable<T> self, Closure closure) Selects the item in the iterable which when passed as a parameter to the supplied closure returns the maximum value. |
<T> |
static T |
max(Iterator<T> self, Closure closure) Selects the maximum value found from the Iterator using the closure to determine the correct ordering. |
<T> |
static T |
max(T[] self, Closure closure) Selects the maximum value found from the Object array using the closure to determine the correct ordering. |
<T> |
static T |
max(Collection<T> self, Comparator<T> comparator) @deprecated Use the Iterable version of max instead |
<T> |
static T |
max(Iterable<T> self, Comparator<T> comparator) Selects the maximum value found in the Iterable using the given comparator. |
<T> |
static T |
max(Iterator<T> self, Comparator<T> comparator) Selects the maximum value found from the Iterator using the given comparator. |
<T> |
static T |
max(T[] self, Comparator<T> comparator) Selects the maximum value found from the Object array using the given comparator. |
|
static MetaClass |
metaClass(Class self, Closure closure) Sets/updates the metaclass for a given class to a closure. |
|
static MetaClass |
metaClass(Object self, Closure closure) Sets/updates the metaclass for a given object to a closure. |
<T> |
static T |
min(Collection<T> self) @deprecated Use the Iterable version of min instead |
<T> |
static T |
min(Iterable<T> self) Adds min() method to Collection objects. |
<T> |
static T |
min(Iterator<T> self) Adds min() method to Iterator objects. |
<T> |
static T |
min(T[] self) Adds min() method to Object arrays. |
<T> |
static T |
min(Collection<T> self, Comparator<T> comparator) @deprecated Use the Iterable version of min instead |
<T> |
static T |
min(Iterable<T> self, Comparator<T> comparator) Selects the minimum value found in the Iterable using the given comparator. |
<T> |
static T |
min(Iterator<T> self, Comparator<T> comparator) Selects the minimum value found from the Iterator using the given comparator. |
<T> |
static T |
min(T[] self, Comparator<T> comparator) Selects the minimum value found from the Object array using the given comparator. |
<T> |
static T |
min(Collection<T> self, Closure closure) @deprecated Use the Iterable version of min instead |
<T> |
static T |
min(Iterable<T> self, Closure closure) Selects the item in the iterable which when passed as a parameter to the supplied closure returns the minimum value. |
<K, V> |
static Map.Entry<K, V> |
min(Map<K, V> self, Closure closure) Selects an entry in the map having the minimum calculated value as determined by the supplied closure. |
<T> |
static T |
min(Iterator<T> self, Closure closure) Selects the minimum value found from the Iterator using the closure to determine the correct ordering. |
<T> |
static T |
min(T[] self, Closure closure) Selects the minimum value found from the Object array using the closure to determine the correct ordering. |
<T> |
static Set<T> |
minus(Set<T> self, Collection<?> removeMe) Create a Set composed of the elements of the first Set minus the elements of the given Collection. |
<T> |
static Set<T> |
minus(Set<T> self, Iterable<?> removeMe) Create a Set composed of the elements of the first Set minus the elements from the given Iterable. |
<T> |
static Set<T> |
minus(Set<T> self, Object removeMe) Create a Set composed of the elements of the first Set minus the given element. |
<T> |
static SortedSet<T> |
minus(SortedSet<T> self, Collection<?> removeMe) Create a SortedSet composed of the elements of the first SortedSet minus the elements of the given Collection. |
<T> |
static SortedSet<T> |
minus(SortedSet<T> self, Iterable<?> removeMe) Create a SortedSet composed of the elements of the first SortedSet minus the elements of the given Iterable. |
<T> |
static SortedSet<T> |
minus(SortedSet<T> self, Object removeMe) Create a SortedSet composed of the elements of the first SortedSet minus the given element. |
<T> |
static T[] |
minus(T[] self, Iterable removeMe) Create an array composed of the elements of the first array minus the elements of the given Iterable. |
<T> |
static T[] |
minus(T[] self, Object[] removeMe) Create an array composed of the elements of the first array minus the elements of the given array. |
<T> |
static List<T> |
minus(List<T> self, Collection<?> removeMe) Create a List composed of the elements of the first list minus every occurrence of elements of the given Collection. |
<T> |
static Collection<T> |
minus(Collection<T> self, Collection<?> removeMe) Create a new Collection composed of the elements of the first Collection minus every occurrence of elements of the given Collection. |
<T> |
static List<T> |
minus(List<T> self, Iterable<?> removeMe) Create a new List composed of the elements of the first List minus every occurrence of elements of the given Iterable. |
<T> |
static Collection<T> |
minus(Iterable<T> self, Iterable<?> removeMe) Create a new Collection composed of the elements of the first Iterable minus every occurrence of elements of the given Iterable. |
<T> |
static List<T> |
minus(List<T> self, Object removeMe) Create a new List composed of the elements of the first List minus every occurrence of the given element to remove. |
<T> |
static Collection<T> |
minus(Iterable<T> self, Object removeMe) Create a new Collection composed of the elements of the first Iterable minus every occurrence of the given element to remove. |
<T> |
static T[] |
minus(T[] self, Object removeMe) Create a new object array composed of the elements of the first array minus the element to remove. |
<K, V> |
static Map<K, V> |
minus(Map<K, V> self, Map removeMe) Create a Map composed of the entries of the first map minus the entries of the given map. |
|
static Number |
minus(Character left, Number right) @todo maybe a double dispatch thing to handle new large numbers? |
|
static Number |
minus(Number left, Character right) Subtract a Character from a Number. |
|
static Number |
minus(Character left, Character right) Subtract one Character from another. |
|
static CharSequence |
minus(CharSequence self, Object target) |
|
static String |
minus(String self, Object target) |
|
static void |
mixin(MetaClass self, List<Class> categoryClasses) Extend object with category methods. |
|
static void |
mixin(Class self, List<Class> categoryClasses) Extend class globally with category methods. |
|
static void |
mixin(Class self, Class categoryClass) Extend class globally with category methods. |
|
static void |
mixin(Class self, Class[] categoryClass) Extend class globally with category methods. |
|
static void |
mixin(MetaClass self, Class categoryClass) Extend class globally with category methods. |
|
static void |
mixin(MetaClass self, Class[] categoryClass) Extend class globally with category methods. |
|
static Number |
mod(Number left, Number right) Performs a division modulus operation. |
<T> |
static Collection<T> |
multiply(Collection<T> self, Number factor) @deprecated use the Iterable variant instead |
<T> |
static Collection<T> |
multiply(Iterable<T> self, Number factor) Create a Collection composed of the elements of this Iterable, repeated a certain number of times. |
<T> |
static List<T> |
multiply(List<T> self, Number factor) Create a List composed of the elements of this Iterable, repeated a certain number of times. |
|
static Number |
multiply(Character left, Number right) Multiply a Character by a Number. |
|
static Number |
multiply(Number left, Character right) Multiply a Number by a Character. |
|
static Number |
multiply(Character left, Character right) Multiply two Characters. |
|
static Number |
multiply(BigDecimal left, Double right) Multiply a BigDecimal and a Double. |
|
static Number |
multiply(BigDecimal left, BigInteger right) Multiply a BigDecimal and a BigInteger. |
|
static CharSequence |
multiply(CharSequence self, Number factor) |
|
static String |
multiply(String self, Number factor) |
|
static DataInputStream |
newDataInputStream(File file) |
|
static DataOutputStream |
newDataOutputStream(File file) |
|
static BufferedInputStream |
newInputStream(File file) |
|
static BufferedInputStream |
newInputStream(URL url) |
|
static BufferedInputStream |
newInputStream(URL url, Map parameters) |
<T> |
static T |
newInstance(Class<T> c) Convenience method to dynamically create a new instance of this class. |
<T> |
static T |
newInstance(Class<T> c, Object[] args) Helper to construct a new instance from the given arguments. |
|
static ObjectInputStream |
newObjectInputStream(File file) |
|
static ObjectInputStream |
newObjectInputStream(InputStream inputStream) |
|
static ObjectInputStream |
newObjectInputStream(InputStream inputStream, ClassLoader classLoader) |
|
static ObjectInputStream |
newObjectInputStream(File file, ClassLoader classLoader) |
|
static ObjectOutputStream |
newObjectOutputStream(File file) |
|
static ObjectOutputStream |
newObjectOutputStream(OutputStream outputStream) |
|
static BufferedOutputStream |
newOutputStream(File file) |
|
static PrintWriter |
newPrintWriter(File file) |
|
static PrintWriter |
newPrintWriter(File file, String charset) |
|
static PrintWriter |
newPrintWriter(Writer writer) |
|
static BufferedReader |
newReader(File file) |
|
static BufferedReader |
newReader(File file, String charset) |
|
static BufferedReader |
newReader(InputStream self) |
|
static BufferedReader |
newReader(InputStream self, String charset) |
|
static BufferedReader |
newReader(URL url) |
|
static BufferedReader |
newReader(URL url, Map parameters) |
|
static BufferedReader |
newReader(URL url, String charset) |
|
static BufferedReader |
newReader(URL url, Map parameters, String charset) |
|
static BufferedWriter |
newWriter(File file) |
|
static BufferedWriter |
newWriter(File file, boolean append) |
|
static BufferedWriter |
newWriter(File file, String charset, boolean append) |
|
static BufferedWriter |
newWriter(File file, String charset) |
|
static Character |
next(Character self) Increment a Character by one. |
|
static Number |
next(Number self) Increment a Number by one. |
|
static CharSequence |
next(CharSequence self) |
|
static String |
next(String self) |
|
static CharSequence |
normalize(CharSequence self) |
|
static String |
normalize(String self) |
|
static int |
numberAwareCompareTo(Comparable self, Comparable other) Provides a method that compares two comparables using Groovy's default number aware comparator. |
|
static Number |
or(Number left, Number right) Bitwise OR together two numbers. |
|
static BitSet |
or(BitSet left, BitSet right) Bitwise OR together two BitSets. |
|
static Boolean |
or(Boolean left, Boolean right) Logical disjunction of two boolean operators |
|
static CharSequence |
padLeft(CharSequence self, Number numberOfChars) |
|
static CharSequence |
padLeft(CharSequence self, Number numberOfChars, CharSequence padding) |
|
static String |
padLeft(String self, Number numberOfChars) |
|
static String |
padLeft(String self, Number numberOfChars, String padding) |
|
static CharSequence |
padRight(CharSequence self, Number numberOfChars) |
|
static CharSequence |
padRight(CharSequence self, Number numberOfChars, CharSequence padding) |
|
static String |
padRight(String self, Number numberOfChars) |
|
static String |
padRight(String self, Number numberOfChars, String padding) |
<T> |
static Set<List<T>> |
permutations(Iterable<T> self) Finds all permutations of an iterable. |
<T> |
static Set<List<T>> |
permutations(List<T> self) @deprecated Use the Iterable version of permutations instead |
<T, V> |
static List<V> |
permutations(Iterable<T> self, Closure<V> function) Finds all permutations of an iterable, applies a function to each permutation and collects the result into a list. |
<T, V> |
static List<V> |
permutations(List<T> self, Closure<V> function) @deprecated Use the Iterable version of permutations instead |
<K, V> |
static Map<K, V> |
plus(Map<K, V> left, Map<K, V> right) Returns a new Map containing all entries from left and right ,
giving precedence to right . |
<K, V> |
static Map<K, V> |
plus(Map<K, V> self, Collection<? extends def> entries) Returns a new Map containing all entries from self and entries ,
giving precedence to entries . |
<T> |
static T[] |
plus(T[] left, T[] right) Create an array as a union of two arrays. |
<T> |
static T[] |
plus(T[] left, T right) Create an array containing elements from an original array plus an additional appended element. |
<T> |
static T[] |
plus(T[] left, Collection<T> right) Create an array containing elements from an original array plus those from a Collection. |
<T> |
static T[] |
plus(T[] left, Iterable<T> right) Create an array containing elements from an original array plus those from an Iterable. |
<T> |
static Collection<T> |
plus(Collection<T> left, Collection<T> right) Create a Collection as a union of two collections. |
<T> |
static Collection<T> |
plus(Iterable<T> left, Iterable<T> right) Create a Collection as a union of two iterables. |
<T> |
static Collection<T> |
plus(Collection<T> left, Iterable<T> right) Create a Collection as a union of a Collection and an Iterable. |
<T> |
static List<T> |
plus(List<T> left, Iterable<T> right) Create a List as a union of a List and an Iterable. |
<T> |
static List<T> |
plus(List<T> left, Collection<T> right) Create a List as a union of a List and an Collection. |
<T> |
static Set<T> |
plus(Set<T> left, Iterable<T> right) Create a Set as a union of a Set and an Iterable. |
<T> |
static Set<T> |
plus(Set<T> left, Collection<T> right) Create a Set as a union of a Set and an Collection. |
<T> |
static SortedSet<T> |
plus(SortedSet<T> left, Iterable<T> right) Create a SortedSet as a union of a SortedSet and an Iterable. |
<T> |
static SortedSet<T> |
plus(SortedSet<T> left, Collection<T> right) Create a SortedSet as a union of a SortedSet and an Collection. |
<T> |
static List<T> |
plus(List<T> self, int index, T[] items) Creates a new List by inserting all of the elements in the specified array to the elements from the original List at the specified index. |
<T> |
static List<T> |
plus(List<T> self, int index, List<T> additions) Creates a new List by inserting all of the elements in the given additions List to the elements from the original List at the specified index. |
<T> |
static List<T> |
plus(List<T> self, int index, Iterable<T> additions) Creates a new List by inserting all of the elements in the given Iterable to the elements from this List at the specified index. |
<T> |
static Collection<T> |
plus(Collection<T> left, T right) Create a collection as a union of a Collection and an Object. |
<T> |
static Collection<T> |
plus(Iterable<T> left, T right) Create a collection as a union of an Iterable and an Object. |
<T> |
static List<T> |
plus(List<T> left, T right) Create a List as a union of a List and an Object. |
<T> |
static Set<T> |
plus(Set<T> left, T right) Create a Set as a union of a Set and an Object. |
<T> |
static SortedSet<T> |
plus(SortedSet<T> left, T right) Create a SortedSet as a union of a SortedSet and an Object. |
|
static Number |
plus(Character left, Number right) Add a Character and a Number. |
|
static Number |
plus(Number left, Character right) Add a Number and a Character. |
|
static Number |
plus(Character left, Character right) Add one Character to another. |
|
static CharSequence |
plus(CharSequence left, Object value) |
|
static String |
plus(Number value, String right) |
|
static String |
plus(String left, Object value) |
|
static String |
plus(StringBuffer left, String value) |
<T> |
static T |
pop(List<T> self) Removes the last item from the List. |
|
static Number |
power(Number self, Number exponent) Power of a Number to a certain exponent. |
|
static Number |
power(BigDecimal self, Integer exponent) Power of a BigDecimal to an integer certain exponent. |
|
static Number |
power(BigInteger self, Integer exponent) Power of a BigInteger to an integer certain exponent. |
|
static Number |
power(Integer self, Integer exponent) Power of an integer to an integer certain exponent. |
|
static Number |
power(Long self, Integer exponent) Power of a long to an integer certain exponent. |
|
static BigInteger |
power(BigInteger self, BigInteger exponent) Power of a BigInteger to a BigInteger certain exponent. |
|
static Character |
previous(Character self) Decrement a Character by one. |
|
static Number |
previous(Number self) Decrement a Number by one. |
|
static CharSequence |
previous(CharSequence self) |
|
static String |
previous(String self) |
|
protected static Object |
primitiveArrayGet(Object self, int idx) Implements the getAt(int) method for primitive type arrays. |
|
protected static List |
primitiveArrayGet(Object self, Range range) Implements the getAt(Range) method for primitive type arrays. |
|
protected static List |
primitiveArrayGet(Object self, Collection indices) Implements the getAt(Collection) method for primitive type arrays. |
|
protected static Object |
primitiveArrayPut(Object self, int idx, Object newValue) Implements the setAt(int idx) method for primitive type arrays. |
|
static void |
print(Object self, Object value) Print a value formatted Groovy style to self if it is a Writer, otherwise to the standard output stream. |
|
static void |
print(PrintWriter self, Object value) Print a value formatted Groovy style to the print writer. |
|
static void |
print(PrintStream self, Object value) Print a value formatted Groovy style to the print stream. |
|
static void |
print(Closure self, Object value) Print a value to the standard output stream. |
|
static void |
print(Object self, PrintWriter out) Print to a console in interactive format. |
|
static void |
printf(Object self, String format, Object[] values) Printf to a console. |
|
static void |
printf(Object self, String format, Object arg) Prints a formatted string using the specified format string and arguments. |
|
static void |
println(Object self) Print a linebreak to the standard output stream. |
|
static void |
println(Closure self) Print a linebreak to the standard output stream. |
|
static void |
println(Object self, Object value) Print a value formatted Groovy style (followed by a newline) to self if it is a Writer, otherwise to the standard output stream. |
|
static void |
println(PrintWriter self, Object value) Print a value formatted Groovy style (followed by a newline) to the print writer. |
|
static void |
println(PrintStream self, Object value) Print a value formatted Groovy style (followed by a newline) to the print stream. |
|
static void |
println(Closure self, Object value) Print a value (followed by a newline) to the standard output stream. |
|
static void |
println(Object self, PrintWriter out) Print to a console in interactive format. |
<T> |
static boolean |
push(List<T> self, T value) Appends an item to the List. |
<K, V> |
static Map<K, V> |
putAll(Map<K, V> self, Collection<? extends def> entries) Provides an easy way to append multiple Map.Entry values to a Map. |
|
static void |
putAt(Object self, String property, Object newValue) Allows the subscript operator to be used to set dynamically named property values. |
<T> |
static void |
putAt(List<T> self, int idx, T value) A helper method to allow lists to work with subscript operators. |
|
static void |
putAt(List self, EmptyRange range, Object value) A helper method to allow lists to work with subscript operators. |
|
static void |
putAt(List self, EmptyRange range, Collection value) A helper method to allow lists to work with subscript operators. |
|
static void |
putAt(List self, IntRange range, Collection col) List subscript assignment operator when given a range as the index and the assignment operand is a collection. |
|
static void |
putAt(List self, IntRange range, Object value) List subscript assignment operator when given a range as the index. |
|
static void |
putAt(List self, List splice, List values) A helper method to allow lists to work with subscript operators. |
|
static void |
putAt(List self, List splice, Object value) A helper method to allow lists to work with subscript operators. |
<K, V> |
static V |
putAt(Map<K, V> self, K key, V value) A helper method to allow maps to work with subscript operators |
|
static void |
putAt(BitSet self, IntRange range, boolean value) Support assigning a range of values with a single assignment statement. |
|
static void |
putAt(BitSet self, int index, boolean value) Support subscript-style assignment for a BitSet. |
|
static void |
putAt(StringBuffer self, EmptyRange range, Object value) |
|
static void |
putAt(StringBuffer self, IntRange range, Object value) |
|
static byte[] |
readBytes(File file) |
|
static String |
readLine(Reader self) |
|
static List<String> |
readLines(CharSequence self) |
|
static List<String> |
readLines(String self) |
|
static List<String> |
readLines(File file) |
|
static List<String> |
readLines(File file, String charset) |
|
static List<String> |
readLines(InputStream stream) |
|
static List<String> |
readLines(InputStream stream, String charset) |
|
static List<String> |
readLines(URL self) |
|
static List<String> |
readLines(URL self, String charset) |
|
static List<String> |
readLines(Reader reader) |
|
static boolean |
removeAll(Collection self, Object[] items) Modifies this collection by removing its elements that are contained within the specified object array. |
<T> |
static boolean |
removeAll(Collection<T> self, Closure condition) Modifies this collection by removing the elements that are matched according to the specified closure condition. |
<E> |
static E |
removeAt(List<E> self, int index) Modifies this list by removing the element at the specified position in this list. |
<E> |
static boolean |
removeElement(Collection<E> self, Object o) Modifies this collection by removing a single instance of the specified element from this collection, if it is present. |
|
static boolean |
renameTo(File self, String newPathName) |
|
static CharSequence |
replaceAll(CharSequence self, CharSequence regex, CharSequence replacement) |
|
static CharSequence |
replaceAll(CharSequence self, CharSequence regex, Closure closure) |
|
static CharSequence |
replaceAll(CharSequence self, Pattern pattern, CharSequence replacement) |
|
static String |
replaceAll(CharSequence self, Pattern pattern, Closure closure) |
|
static String |
replaceAll(String self, Pattern pattern, Closure closure) |
|
static String |
replaceAll(String self, Pattern pattern, String replacement) |
|
static String |
replaceAll(String self, String regex, Closure closure) |
|
static String |
replaceFirst(CharSequence self, CharSequence regex, CharSequence replacement) |
|
static String |
replaceFirst(CharSequence self, CharSequence regex, Closure closure) |
|
static CharSequence |
replaceFirst(CharSequence self, Pattern pattern, CharSequence replacement) |
|
static String |
replaceFirst(CharSequence self, Pattern pattern, Closure closure) |
|
static String |
replaceFirst(String self, Pattern pattern, Closure closure) |
|
static String |
replaceFirst(String self, Pattern pattern, String replacement) |
|
static String |
replaceFirst(String self, String regex, Closure closure) |
|
static List<MetaMethod> |
respondsTo(Object self, String name, Object[] argTypes) |
|
static List<MetaMethod> |
respondsTo(Object self, String name) |
|
static boolean |
retainAll(Collection self, Object[] items) Modifies this collection so that it retains only its elements that are contained in the specified array. |
<T> |
static boolean |
retainAll(Collection<T> self, Closure condition) Modifies this collection so that it retains only its elements that are matched according to the specified closure condition. |
<T> |
static List<T> |
reverse(List<T> self) Creates a new List with the identical contents to this list but in reverse order. |
<T> |
static List<T> |
reverse(List<T> self, boolean mutate) Reverses the elements in a list. |
<T> |
static T[] |
reverse(T[] self) Creates a new array containing items which are the same as this array but in reverse order. |
<T> |
static T[] |
reverse(T[] self, boolean mutate) Reverse the items in an array. |
<T> |
static Iterator<T> |
reverse(Iterator<T> self) Reverses the iterator. |
|
static CharSequence |
reverse(CharSequence self) |
|
static String |
reverse(String self) |
<K, V> |
static Map<K, V> |
reverseEach(Map<K, V> self, Closure closure) Allows a Map to be iterated through in reverse order using a closure. |
<T> |
static List<T> |
reverseEach(List<T> self, Closure closure) Iterate over each element of the list in the reverse order. |
<T> |
static T[] |
reverseEach(T[] self, Closure closure) Iterate over each element of the array in the reverse order. |
|
static Number |
rightShift(Number self, Number operand) Implementation of the right shift operator for integral types. |
|
static Number |
rightShiftUnsigned(Number self, Number operand) Implementation of the right shift (unsigned) operator for integral types. |
|
static int |
round(Float number) Round the value |
|
static float |
round(Float number, int precision) Round the value |
|
static long |
round(Double number) Round the value |
|
static double |
round(Double number, int precision) Round the value |
|
static TimerTask |
runAfter(Timer timer, int delay, Closure closure) Allows a simple syntax for using timers. |
|
static void |
setBytes(File file, byte[] bytes) |
|
static void |
setBytes(OutputStream os, byte[] bytes) |
|
static void |
setIndex(Matcher matcher, int idx) |
|
static void |
setMetaClass(Class self, MetaClass metaClass) Sets the metaclass for a given class. |
|
static void |
setMetaClass(Object self, MetaClass metaClass) Set the metaclass for an object. |
|
static void |
setMetaClass(GroovyObject self, MetaClass metaClass) Set the metaclass for a GroovyObject. |
|
static void |
setText(File file, String text) |
|
static void |
setText(File file, String text, String charset) |
|
static int |
size(Iterator self) Provide the standard Groovy size() method for Iterator .
|
|
static int |
size(Iterable self) Provide the standard Groovy size() method for Iterable .
|
|
static int |
size(Object[] self) Provide the standard Groovy size() method for an array. |
|
static int |
size(boolean[] array) Allows arrays to behave similar to collections. |
|
static int |
size(byte[] array) Allows arrays to behave similar to collections. |
|
static int |
size(char[] array) Allows arrays to behave similar to collections. |
|
static int |
size(short[] array) Allows arrays to behave similar to collections. |
|
static int |
size(int[] array) Allows arrays to behave similar to collections. |
|
static int |
size(long[] array) Allows arrays to behave similar to collections. |
|
static int |
size(float[] array) Allows arrays to behave similar to collections. |
|
static int |
size(double[] array) Allows arrays to behave similar to collections. |
|
static int |
size(CharSequence text) |
|
static long |
size(Matcher self) |
|
static int |
size(String text) |
|
static int |
size(StringBuffer buffer) |
|
static long |
size(File self) |
<T> |
static List<T> |
sort(Collection<T> self) @deprecated Use the Iterable version of sort instead |
<T> |
static List<T> |
sort(Iterable<T> self) Sorts the Collection. |
<T> |
static List<T> |
sort(Collection<T> self, boolean mutate) @deprecated Use the Iterable version of sort instead |
<T> |
static List<T> |
sort(Iterable<T> self, boolean mutate) Sorts the Iterable. |
<K, V> |
static Map<K, V> |
sort(Map<K, V> self, Closure closure) Sorts the elements from the given map into a new ordered map using the closure as a comparator to determine the ordering. |
<K, V> |
static Map<K, V> |
sort(Map<K, V> self, Comparator<? super K> comparator) Sorts the elements from the given map into a new ordered Map using the specified key comparator to determine the ordering. |
<K, V> |
static Map<K, V> |
sort(Map<K, V> self) Sorts the elements from the given map into a new ordered Map using the natural ordering of the keys to determine the ordering. |
<T> |
static T[] |
sort(T[] self) Modifies this array so that its elements are in sorted order. |
<T> |
static T[] |
sort(T[] self, boolean mutate) Sorts the given array into sorted order. |
<T> |
static Iterator<T> |
sort(Iterator<T> self) Sorts the given iterator items into a sorted iterator. |
<T> |
static Iterator<T> |
sort(Iterator<T> self, Comparator<? super T> comparator) Sorts the given iterator items into a sorted iterator using the comparator. |
<T> |
static List<T> |
sort(Collection<T> self, Comparator<T> comparator) @deprecated Use the Iterable version of sort instead |
<T> |
static List<T> |
sort(Collection<T> self, boolean mutate, Comparator<T> comparator) @deprecated Use the Iterable version of sort instead |
<T> |
static List<T> |
sort(Iterable<T> self, boolean mutate, Comparator<? super T> comparator) Sorts the Iterable using the given Comparator. |
<T> |
static T[] |
sort(T[] self, Comparator<? super T> comparator) Sorts the given array into sorted order using the given comparator. |
<T> |
static T[] |
sort(T[] self, boolean mutate, Comparator<? super T> comparator) Modifies this array so that its elements are in sorted order as determined by the given comparator. |
<T> |
static Iterator<T> |
sort(Iterator<T> self, Closure closure) Sorts the given iterator items into a sorted iterator using the Closure to determine the correct ordering. |
<T> |
static T[] |
sort(T[] self, Closure closure) Sorts the elements from this array into a newly created array using the Closure to determine the correct ordering. |
<T> |
static T[] |
sort(T[] self, boolean mutate, Closure closure) Modifies this array so that its elements are in sorted order using the Closure to determine the correct ordering. |
<T> |
static List<T> |
sort(Collection<T> self, boolean mutate, Closure closure) @deprecated Use the Iterable version of sort instead |
<T> |
static List<T> |
sort(Collection<T> self, Closure closure) @deprecated Use the Iterable version of sort instead |
<T> |
static List<T> |
sort(Iterable<T> self, Closure closure) Sorts this Iterable using the given Closure to determine the correct ordering. |
<T> |
static List<T> |
sort(Iterable<T> self, boolean mutate, Closure closure) Sorts this Iterable using the given Closure to determine the correct ordering. |
<T> |
static SortedSet<T> |
sort(SortedSet<T> self) Avoids doing unnecessary work when sorting an already sorted set (i.e. an identity function for an already sorted set). |
<K, V> |
static SortedMap<K, V> |
sort(SortedMap<K, V> self) Avoids doing unnecessary work when sorting an already sorted map (i.e. an identity function for an already sorted map). |
|
static Collection |
split(Object self, Closure closure) Splits all items into two lists based on the closure condition. |
<T> |
static Collection<Collection<T>> |
split(Collection<T> self, Closure closure) Splits all items into two collections based on the closure condition. |
<T> |
static List<List<T>> |
split(List<T> self, Closure closure) Splits all items into two collections based on the closure condition. |
<T> |
static List<Set<T>> |
split(Set<T> self, Closure closure) Splits all items into two collections based on the closure condition. |
|
static CharSequence[] |
split(CharSequence self) |
|
static String[] |
split(GString self) |
|
static String[] |
split(String self) |
<T> |
static T |
splitEachLine(CharSequence self, CharSequence regex, Closure<T> closure) |
<T> |
static T |
splitEachLine(CharSequence self, Pattern pattern, Closure<T> closure) |
<T> |
static T |
splitEachLine(String self, Pattern pattern, Closure<T> closure) |
<T> |
static T |
splitEachLine(String self, String regex, Closure<T> closure) |
<T> |
static T |
splitEachLine(File self, String regex, Closure<T> closure) |
<T> |
static T |
splitEachLine(File self, Pattern pattern, Closure<T> closure) |
<T> |
static T |
splitEachLine(File self, String regex, String charset, Closure<T> closure) |
<T> |
static T |
splitEachLine(File self, Pattern pattern, String charset, Closure<T> closure) |
<T> |
static T |
splitEachLine(URL self, String regex, Closure<T> closure) |
<T> |
static T |
splitEachLine(URL self, Pattern pattern, Closure<T> closure) |
<T> |
static T |
splitEachLine(URL self, String regex, String charset, Closure<T> closure) |
<T> |
static T |
splitEachLine(URL self, Pattern pattern, String charset, Closure<T> closure) |
<T> |
static T |
splitEachLine(Reader self, String regex, Closure<T> closure) |
<T> |
static T |
splitEachLine(Reader self, Pattern pattern, Closure<T> closure) |
<T> |
static T |
splitEachLine(InputStream stream, String regex, String charset, Closure<T> closure) |
<T> |
static T |
splitEachLine(InputStream stream, Pattern pattern, String charset, Closure<T> closure) |
<T> |
static T |
splitEachLine(InputStream stream, String regex, Closure<T> closure) |
<T> |
static T |
splitEachLine(InputStream stream, Pattern pattern, Closure<T> closure) |
|
static SpreadMap |
spread(Map self) Synonym for toSpreadMap(java.util.Map). |
|
static String |
sprintf(Object self, String format, Object[] values) Sprintf to a string. |
|
static String |
sprintf(Object self, String format, Object arg) Returns a formatted string using the specified format string and arguments. |
|
static void |
step(Number self, Number to, Number stepNumber, Closure closure) Iterates from this number up to the given number using a step increment. |
|
static CharSequence |
stripIndent(CharSequence self) |
|
static CharSequence |
stripIndent(CharSequence self, int numChars) |
|
static String |
stripIndent(String self) |
|
static String |
stripIndent(String self, int numChars) |
|
static CharSequence |
stripMargin(CharSequence self) |
|
static CharSequence |
stripMargin(CharSequence self, char marginChar) |
|
static String |
stripMargin(CharSequence self, CharSequence marginChar) |
|
static String |
stripMargin(String self) |
|
static String |
stripMargin(String self, char marginChar) |
|
static String |
stripMargin(String self, String marginChar) |
<K, V> |
static Map<K, V> |
subMap(Map<K, V> map, Collection<K> keys) Creates a sub-Map containing the given keys. |
<K, V> |
static Map<K, V> |
subMap(Map<K, V> map, K[] keys) Creates a sub-Map containing the given keys. |
<T> |
static Set<List<T>> |
subsequences(List<T> self) Finds all non-null subsequences of a list. |
|
static Object |
sum(Collection self) @deprecated Use the Iterable version of sum instead |
|
static Object |
sum(Iterable self) Sums the items in an Iterable. |
|
static Object |
sum(Object[] self) Sums the items in an array. |
|
static Object |
sum(Iterator<Object> self) Sums the items from an Iterator. |
|
static byte |
sum(byte[] self) Sums the items in an array. |
|
static short |
sum(short[] self) Sums the items in an array. |
|
static int |
sum(int[] self) Sums the items in an array. |
|
static long |
sum(long[] self) Sums the items in an array. |
|
static char |
sum(char[] self) Sums the items in an array. |
|
static float |
sum(float[] self) Sums the items in an array. |
|
static double |
sum(double[] self) Sums the items in an array. |
|
static Object |
sum(Collection self, Object initialValue) @deprecated Use the Iterable version of sum instead |
|
static Object |
sum(Iterable self, Object initialValue) Sums the items in an Iterable, adding the result to some initial value. |
|
static Object |
sum(Object[] self, Object initialValue) Sums the items in an array, adding the result to some initial value. |
|
static Object |
sum(Iterator<Object> self, Object initialValue) Sums the items from an Iterator, adding the result to some initial value. |
|
static byte |
sum(byte[] self, byte initialValue) Sums the items in an array, adding the result to some initial value. |
|
static short |
sum(short[] self, short initialValue) Sums the items in an array, adding the result to some initial value. |
|
static int |
sum(int[] self, int initialValue) Sums the items in an array, adding the result to some initial value. |
|
static long |
sum(long[] self, long initialValue) Sums the items in an array, adding the result to some initial value. |
|
static char |
sum(char[] self, char initialValue) Sums the items in an array, adding the result to some initial value. |
|
static float |
sum(float[] self, float initialValue) Sums the items in an array, adding the result to some initial value. |
|
static double |
sum(double[] self, double initialValue) Sums the items in an array, adding the result to some initial value. |
|
static Object |
sum(Collection self, Closure closure) @deprecated Use the Iterable version of sum instead |
|
static Object |
sum(Iterable self, Closure closure) Sums the result of apply a closure to each item of an Iterable. |
|
static Object |
sum(Object[] self, Closure closure) Sums the result of apply a closure to each item of an array. |
|
static Object |
sum(Iterator<Object> self, Closure closure) Sums the result of apply a closure to each item returned from an iterator. |
|
static Object |
sum(Collection self, Object initialValue, Closure closure) @deprecated Use the Iterable version of sum instead |
|
static Object |
sum(Iterable self, Object initialValue, Closure closure) Sums the result of applying a closure to each item of an Iterable to some initial value. |
|
static Object |
sum(Object[] self, Object initialValue, Closure closure) Sums the result of applying a closure to each item of an array to some initial value. |
|
static Object |
sum(Iterator<Object> self, Object initialValue, Closure closure) Sums the result of applying a closure to each item of an Iterator to some initial value. |
<T> |
static List<T> |
swap(List<T> self, int i, int j) Swaps two elements at the specified positions. |
<T> |
static T[] |
swap(T[] self, int i, int j) Swaps two elements at the specified positions. |
|
static boolean[] |
swap(boolean[] self, int i, int j) Swaps two elements at the specified positions. |
|
static byte[] |
swap(byte[] self, int i, int j) Swaps two elements at the specified positions. |
|
static char[] |
swap(char[] self, int i, int j) Swaps two elements at the specified positions. |
|
static double[] |
swap(double[] self, int i, int j) Swaps two elements at the specified positions. |
|
static float[] |
swap(float[] self, int i, int j) Swaps two elements at the specified positions. |
|
static int[] |
swap(int[] self, int i, int j) Swaps two elements at the specified positions. |
|
static long[] |
swap(long[] self, int i, int j) Swaps two elements at the specified positions. |
|
static short[] |
swap(short[] self, int i, int j) Swaps two elements at the specified positions. |
<T> |
static List<T> |
tail(List<T> self) Returns the items from the List excluding the first item. |
<T> |
static SortedSet<T> |
tail(SortedSet<T> self) Returns the items from the SortedSet excluding the first item. |
<T> |
static Collection<T> |
tail(Iterable<T> self) Returns the items from the Iterable excluding the first item. |
<T> |
static T[] |
tail(T[] self) Returns the items from the array excluding the first item. |
<T> |
static Iterator<T> |
tail(Iterator<T> self) Returns the original iterator after throwing away the first element. |
<T> |
static List<T> |
take(List<T> self, int num) Returns the first num elements from the head of this List.
|
<T> |
static SortedSet<T> |
take(SortedSet<T> self, int num) Returns the first num elements from the head of this SortedSet.
|
<T> |
static T[] |
take(T[] self, int num) Returns the first num elements from the head of this array.
|
<T> |
static Collection<T> |
take(Iterable<T> self, int num) Returns the first num elements from the head of this Iterable.
|
<K, V> |
static Map<K, V> |
take(Map<K, V> self, int num) Returns a new map containing the first num elements from the head of this map.
|
<T> |
static Iterator<T> |
take(Iterator<T> self, int num) Returns an iterator of up to the first num elements from this iterator.
|
|
static CharSequence |
take(CharSequence self, int num) |
<T> |
static T[] |
takeRight(T[] self, int num) Returns the last num elements from the tail of this array.
|
<T> |
static Collection<T> |
takeRight(Iterable<T> self, int num) Returns the last num elements from the tail of this Iterable.
|
<T> |
static List<T> |
takeRight(List<T> self, int num) Returns the last num elements from the tail of this List.
|
<T> |
static SortedSet<T> |
takeRight(SortedSet<T> self, int num) Returns the last num elements from the tail of this SortedSet.
|
<T> |
static List<T> |
takeWhile(List<T> self, Closure condition) Returns the longest prefix of this list where each element passed to the given closure condition evaluates to true. |
<T> |
static Collection<T> |
takeWhile(Iterable<T> self, Closure condition) Returns a Collection containing the longest prefix of the elements from this Iterable where each element passed to the given closure evaluates to true. |
<T> |
static SortedSet<T> |
takeWhile(SortedSet<T> self, Closure condition) Returns the longest prefix of this SortedSet where each element passed to the given closure condition evaluates to true. |
<K, V> |
static Map<K, V> |
takeWhile(Map<K, V> self, Closure<?> condition) Returns the longest prefix of this Map where each entry (or key/value pair) when passed to the given closure evaluates to true. |
<T> |
static T[] |
takeWhile(T[] self, Closure condition) Returns the longest prefix of this array where each element passed to the given closure evaluates to true. |
<T> |
static Iterator<T> |
takeWhile(Iterator<T> self, Closure condition) Returns the longest prefix of elements in this iterator where each element passed to the given condition closure evaluates to true. |
|
static void |
times(Number self, Closure closure) Executes the closure this many times, starting from zero. |
|
static String |
toArrayString(Object[] self) Returns the string representation of the given array. |
|
static BigDecimal |
toBigDecimal(Number self) Transform a Number into a BigDecimal |
|
static BigDecimal |
toBigDecimal(CharSequence self) |
|
static BigDecimal |
toBigDecimal(String self) |
|
static BigInteger |
toBigInteger(Number self) Transform this Number into a BigInteger. |
|
static BigInteger |
toBigInteger(CharSequence self) |
|
static BigInteger |
toBigInteger(String self) |
|
static Boolean |
toBoolean(Boolean self) Identity conversion which returns Boolean.TRUE for a true Boolean and Boolean.FALSE for a false Boolean. |
|
static Boolean |
toBoolean(String self) |
|
static Character |
toCharacter(String self) |
|
static Double |
toDouble(Number self) Transform a Number into a Double |
|
static Double |
toDouble(CharSequence self) |
|
static Double |
toDouble(String self) |
|
static Float |
toFloat(Number self) Transform a Number into a Float |
|
static Float |
toFloat(CharSequence self) |
|
static Float |
toFloat(String self) |
|
static Integer |
toInteger(Number self) Transform a Number into an Integer |
|
static Integer |
toInteger(CharSequence self) |
|
static Integer |
toInteger(String self) |
<T> |
static List<T> |
toList(Collection<T> self) @deprecated Use the Iterable version of toList instead |
<T> |
static List<T> |
toList(Iterator<T> self) Convert an iterator to a List. |
<T> |
static List<T> |
toList(Iterable<T> self) Convert an Iterable to a List. |
<T> |
static List<T> |
toList(Enumeration<T> self) Convert an enumeration to a List. |
<T> |
static List<T> |
toList(T[] array) Allows conversion of arrays into a mutable List. |
|
static List<Byte> |
toList(byte[] array) Converts this array to a List of the same size, with each element added to the list. |
|
static List<Boolean> |
toList(boolean[] array) Converts this array to a List of the same size, with each element added to the list. |
|
static List<Character> |
toList(char[] array) Converts this array to a List of the same size, with each element added to the list. |
|
static List<Short> |
toList(short[] array) Converts this array to a List of the same size, with each element added to the list. |
|
static List<Integer> |
toList(int[] array) Converts this array to a List of the same size, with each element added to the list. |
|
static List<Long> |
toList(long[] array) Converts this array to a List of the same size, with each element added to the list. |
|
static List<Float> |
toList(float[] array) Converts this array to a List of the same size, with each element added to the list. |
|
static List<Double> |
toList(double[] array) Converts this array to a List of the same size, with each element added to the list. |
|
static List<String> |
toList(CharSequence self) |
|
static List<String> |
toList(String self) |
|
static String |
toListString(Collection self) Returns the string representation of the given list. |
|
static String |
toListString(Collection self, int maxSize) Returns the string representation of the given list. |
|
static Long |
toLong(Number self) Transform a Number into a Long |
|
static Long |
toLong(CharSequence self) |
|
static Long |
toLong(String self) |
|
static char |
toLowerCase(Character self) Converts the character to lowercase. |
|
static String |
toMapString(Map self) Returns the string representation of this map. |
|
static String |
toMapString(Map self, int maxSize) Returns the string representation of this map. |
|
static Set<Byte> |
toSet(byte[] array) Converts this array to a Set, with each unique element added to the set. |
|
static Set<Boolean> |
toSet(boolean[] array) Converts this array to a Set, with each unique element added to the set. |
|
static Set<Character> |
toSet(char[] array) Converts this array to a Set, with each unique element added to the set. |
|
static Set<Short> |
toSet(short[] array) Converts this array to a Set, with each unique element added to the set. |
|
static Set<Integer> |
toSet(int[] array) Converts this array to a Set, with each unique element added to the set. |
|
static Set<Long> |
toSet(long[] array) Converts this array to a Set, with each unique element added to the set. |
|
static Set<Float> |
toSet(float[] array) Converts this array to a Set, with each unique element added to the set. |
|
static Set<Double> |
toSet(double[] array) Converts this array to a Set, with each unique element added to the set. |
<T> |
static Set<T> |
toSet(Collection<T> self) Convert a Collection to a Set. |
<T> |
static Set<T> |
toSet(Iterable<T> self) Convert an Iterable to a Set. |
<T> |
static Set<T> |
toSet(Iterator<T> self) Convert an iterator to a Set. |
<T> |
static Set<T> |
toSet(Enumeration<T> self) Convert an enumeration to a Set. |
|
static Set<String> |
toSet(CharSequence self) |
|
static Set<String> |
toSet(String self) |
|
static Short |
toShort(CharSequence self) |
|
static Short |
toShort(String self) |
<T> |
static List<T> |
toSorted(Iterable<T> self) Sorts the Iterable. |
<T> |
static List<T> |
toSorted(Iterable<T> self, Comparator<T> comparator) Sorts the Iterable using the given Comparator. |
<T> |
static List<T> |
toSorted(Iterable<T> self, Closure closure) Sorts this Iterable using the given Closure to determine the correct ordering. |
<T> |
static Iterator<T> |
toSorted(Iterator<T> self) Sorts the Iterator. |
<T> |
static Iterator<T> |
toSorted(Iterator<T> self, Comparator<T> comparator) Sorts the given iterator items using the comparator. |
<T> |
static Iterator<T> |
toSorted(Iterator<T> self, Closure closure) Sorts the given iterator items into a sorted iterator using the Closure to determine the correct ordering. |
<T> |
static T[] |
toSorted(T[] self) Returns a sorted version of the given array using the supplied comparator. |
<T> |
static T[] |
toSorted(T[] self, Comparator<T> comparator) Returns a sorted version of the given array using the supplied comparator to determine the resulting order. |
<T> |
static T[] |
toSorted(T[] self, Closure condition) Sorts the elements from this array into a newly created array using the Closure to determine the correct ordering. |
<K, V> |
static Map<K, V> |
toSorted(Map<K, V> self) Sorts the elements from the given map into a new ordered map using a NumberAwareComparator on map entry values to determine the resulting order. |
<K, V> |
static Map<K, V> |
toSorted(Map<K, V> self, Comparator<Map.Entry<K, V>> comparator) Sorts the elements from the given map into a new ordered map using the supplied comparator to determine the ordering. |
<K, V> |
static Map<K, V> |
toSorted(Map<K, V> self, Closure condition) Sorts the elements from the given map into a new ordered map using the supplied Closure condition as a comparator to determine the ordering. |
<T> |
static Set<T> |
toSorted(SortedSet<T> self) Avoids doing unnecessary work when sorting an already sorted set |
<K, V> |
static Map<K, V> |
toSorted(SortedMap<K, V> self) Avoids doing unnecessary work when sorting an already sorted map |
|
static SpreadMap |
toSpreadMap(Map self) Returns a new SpreadMap from this map. |
|
static SpreadMap |
toSpreadMap(Object[] self) Creates a spreadable map from this array. |
|
static SpreadMap |
toSpreadMap(List self) Creates a spreadable map from this list. |
|
static SpreadMap |
toSpreadMap(Iterable self) Creates a spreadable map from this iterable. |
|
static String |
toString(boolean[] self) Returns the string representation of the given array. |
|
static String |
toString(byte[] self) Returns the string representation of the given array. |
|
static String |
toString(char[] self) Returns the string representation of the given array. |
|
static String |
toString(short[] self) Returns the string representation of the given array. |
|
static String |
toString(int[] self) Returns the string representation of the given array. |
|
static String |
toString(long[] self) Returns the string representation of the given array. |
|
static String |
toString(float[] self) Returns the string representation of the given array. |
|
static String |
toString(double[] self) Returns the string representation of the given array. |
|
static String |
toString(AbstractMap self) Returns the string representation of the given map. |
|
static String |
toString(AbstractCollection self) Returns the string representation of the given collection. |
|
static String |
toString(Object[] self) Returns the string representation of this array's contents. |
|
static String |
toString(Object value) Create a String representation of this object. |
|
static URI |
toURI(CharSequence self) |
|
static URI |
toURI(String self) |
|
static URL |
toURL(CharSequence self) |
|
static URL |
toURL(String self) |
<T> |
static Iterator<T> |
toUnique(Iterator<T> self, Closure condition) Returns an iterator equivalent to this iterator but with all duplicated items removed where duplicate (equal) items are deduced by calling the supplied Closure condition. |
<T> |
static Iterator<T> |
toUnique(Iterator<T> self, Comparator<T> comparator) Returns an iterator equivalent to this iterator with all duplicated items removed by using the supplied comparator. |
<T> |
static Iterator<T> |
toUnique(Iterator<T> self) Returns an iterator equivalent to this iterator with all duplicated items removed by using the natural ordering of the items. |
<T> |
static Collection<T> |
toUnique(Iterable<T> self, Comparator<T> comparator) Returns a Collection containing the items from the Iterable but with duplicates removed. |
<T> |
static List<T> |
toUnique(List<T> self, Comparator<T> comparator) Returns a List containing the items from the List but with duplicates removed. |
<T> |
static Collection<T> |
toUnique(Iterable<T> self) Returns a Collection containing the items from the Iterable but with duplicates removed using the natural ordering of the items to determine uniqueness. |
<T> |
static List<T> |
toUnique(List<T> self) Returns a List containing the items from the List but with duplicates removed using the natural ordering of the items to determine uniqueness. |
<T> |
static Collection<T> |
toUnique(Iterable<T> self, Closure condition) Returns a Collection containing the items from the Iterable but with duplicates removed. |
<T> |
static List<T> |
toUnique(List<T> self, Closure condition) Returns a List containing the items from the List but with duplicates removed. |
<T> |
static T[] |
toUnique(T[] self, Comparator<T> comparator) Returns a new Array containing the items from the original Array but with duplicates removed with the supplied comparator determining which items are unique. |
<T> |
static T[] |
toUnique(T[] self) Returns a new Array containing the items from the original Array but with duplicates removed using the natural ordering of the items in the array. |
<T> |
static T[] |
toUnique(T[] self, Closure condition) Returns a new Array containing the items from the original Array but with duplicates removed with the supplied comparator determining which items are unique. |
|
static char |
toUpperCase(Character self) Converts the character to uppercase. |
|
static List<String> |
tokenize(CharSequence self) |
|
static List<String> |
tokenize(CharSequence self, Character token) |
|
static List<String> |
tokenize(CharSequence self, CharSequence token) |
|
static List<String> |
tokenize(String self) |
|
static List<String> |
tokenize(String self, Character token) |
|
static List<String> |
tokenize(String self, String token) |
|
static CharSequence |
tr(CharSequence self, CharSequence sourceSet, CharSequence replacementSet) |
|
static String |
tr(String self, String sourceSet, String replacementSet) |
|
static void |
transformChar(Reader self, Writer writer, Closure closure) |
|
static void |
transformLine(Reader reader, Writer writer, Closure closure) |
|
static List |
transpose(List self) Adds GroovyCollections#transpose(List) as a method on lists. |
|
static void |
traverse(File self, Map<String, Object> options, Closure closure) |
|
static void |
traverse(File self, Closure closure) |
|
static void |
traverse(File self, Map<String, Object> options) |
|
static float |
trunc(Float number, int precision) Truncate the value |
|
static float |
trunc(Float number) Truncate the value |
|
static double |
trunc(Double number) Truncate the value |
|
static double |
trunc(Double number, int precision) Truncate the value |
|
static Number |
unaryMinus(Number left) Negates the number. |
|
static Number |
unaryPlus(Number left) Returns the number, effectively being a noop for numbers. |
|
static CharSequence |
unexpand(CharSequence self) |
|
static CharSequence |
unexpand(CharSequence self, int tabStop) |
|
static String |
unexpand(String self) |
|
static String |
unexpand(String self, int tabStop) |
|
static CharSequence |
unexpandLine(CharSequence self, int tabStop) |
|
static String |
unexpandLine(String self, int tabStop) |
<T> |
static Iterator<T> |
unique(Iterator<T> self) Returns an iterator equivalent to this iterator with all duplicated items removed by using the default comparator. |
<T> |
static Collection<T> |
unique(Collection<T> self) Modifies this collection to remove all duplicated items, using the default comparator. |
<T> |
static List<T> |
unique(List<T> self) Modifies this List to remove all duplicated items, using the default comparator. |
<T> |
static Collection<T> |
unique(Collection<T> self, boolean mutate) Remove all duplicates from a given Collection using the default comparator. |
<T> |
static List<T> |
unique(List<T> self, boolean mutate) Remove all duplicates from a given List using the default comparator. |
<T> |
static Iterator<T> |
unique(Iterator<T> self, Closure closure) Returns an iterator equivalent to this iterator but with all duplicated items removed by using a Closure to determine duplicate (equal) items. |
<T> |
static Collection<T> |
unique(Collection<T> self, Closure closure) A convenience method for making a collection unique using a Closure to determine duplicate (equal) items. |
<T> |
static List<T> |
unique(List<T> self, Closure closure) A convenience method for making a List unique using a Closure to determine duplicate (equal) items. |
<T> |
static Collection<T> |
unique(Collection<T> self, boolean mutate, Closure closure) A convenience method for making a collection unique using a Closure to determine duplicate (equal) items. |
<T> |
static List<T> |
unique(List<T> self, boolean mutate, Closure closure) A convenience method for making a List unique using a Closure to determine duplicate (equal) items. |
<T> |
static Iterator<T> |
unique(Iterator<T> self, Comparator<T> comparator) Returns an iterator equivalent to this iterator with all duplicated items removed by using the supplied comparator. |
<T> |
static Collection<T> |
unique(Collection<T> self, Comparator<T> comparator) Remove all duplicates from a given Collection. |
<T> |
static List<T> |
unique(List<T> self, Comparator<T> comparator) Remove all duplicates from a given List. |
<T> |
static Collection<T> |
unique(Collection<T> self, boolean mutate, Comparator<T> comparator) Remove all duplicates from a given Collection. |
<T> |
static List<T> |
unique(List<T> self, boolean mutate, Comparator<T> comparator) Remove all duplicates from a given List. |
|
static void |
upto(Number self, Number to, Closure closure) Iterates from this number up to the given number, inclusive, incrementing by one each time. |
|
static void |
upto(long self, Number to, Closure closure) Iterates from this number up to the given number, inclusive, incrementing by one each time. |
|
static void |
upto(Long self, Number to, Closure closure) Iterates from this number up to the given number, inclusive, incrementing by one each time. |
|
static void |
upto(float self, Number to, Closure closure) Iterates from this number up to the given number, inclusive, incrementing by one each time. |
|
static void |
upto(Float self, Number to, Closure closure) Iterates from this number up to the given number, inclusive, incrementing by one each time. |
|
static void |
upto(double self, Number to, Closure closure) Iterates from this number up to the given number, inclusive, incrementing by one each time. |
|
static void |
upto(Double self, Number to, Closure closure) Iterates from this number up to the given number, inclusive, incrementing by one each time. |
|
static void |
upto(BigInteger self, Number to, Closure closure) Iterates from this number up to the given number, inclusive, incrementing by one each time. |
|
static void |
upto(BigDecimal self, Number to, Closure closure) Iterates from this number up to the given number, inclusive, incrementing by one each time. |
<T> |
static T |
use(Object self, Class categoryClass, Closure<T> closure) Scoped use method |
<T> |
static T |
use(Object self, List<Class> categoryClassList, Closure<T> closure) Scoped use method with list of categories. |
|
static Object |
use(Object self, Object[] array) Allows you to use a list of categories, specifying the list as varargs. |
<T, U> |
static T |
with(U self, Closure<T> closure) Allows the closure to be called for the object reference self. |
<T> |
static T |
withDataInputStream(File file, Closure<T> closure) |
<T> |
static T |
withDataOutputStream(File file, Closure<T> closure) |
<K, V> |
static Map<K, V> |
withDefault(Map<K, V> self, Closure init) Wraps a map using the decorator pattern with a wrapper that intercepts all calls to get(key) . |
<T> |
static List<T> |
withDefault(List<T> self, Closure init) An alias for withLazyDefault which decorates a list allowing
it to grow when called with index values outside the normal list bounds. |
<T> |
static List<T> |
withEagerDefault(List<T> self, Closure init) Decorates a list allowing it to grow when called with a non-existent index value. |
<E> |
static List<Tuple2<E, Integer>> |
withIndex(Iterable<E> self) Zips an Iterable with indices in (value, index) order. |
<E> |
static List<Tuple2<E, Integer>> |
withIndex(Iterable<E> self, int offset) Zips an Iterable with indices in (value, index) order. |
<E> |
static Iterator<Tuple2<E, Integer>> |
withIndex(Iterator<E> self) Zips an iterator with indices in (value, index) order. |
<E> |
static Iterator<Tuple2<E, Integer>> |
withIndex(Iterator<E> self, int offset) Zips an iterator with indices in (value, index) order. |
|
static Object |
withInputStream(File file, Closure closure) |
<T> |
static T |
withInputStream(URL url, Closure<T> closure) |
<T> |
static List<T> |
withLazyDefault(List<T> self, Closure init) Decorates a list allowing it to grow when called with a non-existent index value. |
<T> |
static T |
withObjectInputStream(File file, Closure<T> closure) |
<T> |
static T |
withObjectInputStream(File file, ClassLoader classLoader, Closure<T> closure) |
<T> |
static T |
withObjectInputStream(InputStream inputStream, Closure<T> closure) |
<T> |
static T |
withObjectInputStream(InputStream inputStream, ClassLoader classLoader, Closure<T> closure) |
<T> |
static T |
withObjectOutputStream(File file, Closure<T> closure) |
<T> |
static T |
withObjectOutputStream(OutputStream outputStream, Closure<T> closure) |
<T> |
static T |
withObjectStreams(Socket socket, Closure<T> closure) |
|
static Object |
withOutputStream(File file, Closure closure) |
<T> |
static T |
withPrintWriter(File file, Closure<T> closure) |
<T> |
static T |
withPrintWriter(File file, String charset, Closure<T> closure) |
<T> |
static T |
withPrintWriter(Writer writer, Closure<T> closure) |
<T> |
static T |
withReader(File file, Closure<T> closure) |
<T> |
static T |
withReader(File file, String charset, Closure<T> closure) |
<T> |
static T |
withReader(Reader reader, Closure<T> closure) |
<T> |
static T |
withReader(URL url, Closure<T> closure) |
<T> |
static T |
withReader(URL url, String charset, Closure<T> closure) |
<T> |
static T |
withReader(InputStream in, Closure<T> closure) |
<T> |
static T |
withReader(InputStream in, String charset, Closure<T> closure) |
<T> |
static T |
withStream(InputStream stream, Closure<T> closure) |
<T> |
static T |
withStream(OutputStream os, Closure<T> closure) |
<T> |
static T |
withStreams(Socket socket, Closure<T> closure) |
|
static Object |
withTraits(Object self, Class<?>... traits) Dynamically wraps an instance into something which implements the supplied trait classes. |
<T> |
static T |
withWriter(File file, Closure<T> closure) |
<T> |
static T |
withWriter(File file, String charset, Closure<T> closure) |
<T> |
static T |
withWriter(Writer writer, Closure<T> closure) |
<T> |
static T |
withWriter(OutputStream stream, Closure<T> closure) |
<T> |
static T |
withWriter(OutputStream stream, String charset, Closure<T> closure) |
<T> |
static T |
withWriterAppend(File file, String charset, Closure<T> closure) |
<T> |
static T |
withWriterAppend(File file, Closure<T> closure) |
|
static void |
write(Writer self, Writable writable) |
|
static void |
write(File file, String text) |
|
static void |
write(File file, String text, String charset) |
|
static void |
writeLine(BufferedWriter writer, String line) |
|
static BitSet |
xor(BitSet left, BitSet right) Bitwise XOR together two BitSets. |
|
static Number |
xor(Number left, Number right) Bitwise XOR together two Numbers. |
|
static Boolean |
xor(Boolean left, Boolean right) Exclusive disjunction of two boolean operators |
Methods inherited from class | Name |
---|---|
class DefaultGroovyMethodsSupport |
cloneSimilarCollection, cloneSimilarMap, closeQuietly, closeWithWarning, createSimilarArray, createSimilarCollection, createSimilarCollection, createSimilarCollection, createSimilarList, createSimilarMap, createSimilarOrDefaultCollection, createSimilarSet, normaliseIndex, sameType, subListBorders, subListBorders |
class Object |
wait, wait, wait, equals, toString, hashCode, getClass, notify, notifyAll |
Get the absolute value
number
- a NumberGet the absolute value
number
- a LongGet the absolute value
number
- a FloatGet the absolute value
number
- a Double Modifies the collection by adding all of the elements in the specified array to the collection.
The behavior of this operation is undefined if
the specified array is modified while the operation is in progress.
See also plus
or the '+' operator if wanting to produce a new collection
containing additional items but while leaving the original collection unchanged.
self
- a Collection to be modifieditems
- array containing elements to be added to this collection Modifies this list by inserting all of the elements in the specified array into the
list at the specified position. Shifts the
element currently at that position (if any) and any subsequent
elements to the right (increases their indices). The new elements
will appear in this list in the order that they occur in the array.
The behavior of this operation is undefined if the specified array
is modified while the operation is in progress.
See also plus
for similar functionality with copy semantics, i.e. which produces a new
list after adding the additional items at the specified position but leaves the original list unchanged.
self
- a list to be modifieditems
- array containing elements to be added to this collectionindex
- index at which to insert the first element from the
specified arrayAdds all items from the iterator to the Collection.
self
- the collectionitems
- the items to addAdds all items from the iterable to the Collection.
self
- the collectionitems
- the items to addAllows the usage of addShutdownHook without getting the runtime first.
self
- the object the method is called on (ignored)closure
- the shutdown hook actionBitwise AND together two Numbers.
left
- a Numberright
- another Number to bitwise ANDBitwise AND together two BitSets.
left
- a BitSetright
- another BitSet to bitwise ANDLogical conjunction of two boolean operators.
left
- left operatorright
- right operatorIterates over the contents of an object or collection, and checks whether a predicate is valid for at least one element.
assert [1, 2, 3].any { it == 2 } assert ![1, 2, 3].any { it > 3 }
self
- the object over which we iterateclosure
- the closure predicate used for matchingIterates over the contents of an iterator, and checks whether a predicate is valid for at least one element.
assert [1, 2, 3].iterator().any { it == 2 } assert ![1, 2, 3].iterator().any { it > 3 }
self
- the iterator over which we iterateclosure
- the closure predicate used for matchingIterates over the contents of an iterable, and checks whether a predicate is valid for at least one element.
assert [1, 2, 3].any { it == 2 } assert ![1, 2, 3].any { it > 3 }
self
- the iterable over which we iterateclosure
- the closure predicate used for matchingIterates over the entries of a map, and checks whether a predicate is valid for at least one entry. 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.
assert [2:3, 4:5, 5:10].any { key, value -> key * 2 == value } assert ![2:3, 4:5, 5:10].any { entry -> entry.key == entry.value * 2 }
self
- the map over which we iterateclosure
- the 1 or 2 arg closure predicate used for matchingIterates over the elements of a collection, and checks whether at least one element is true according to the Groovy Truth. Equivalent to self.any({element -> element})
assert [false, true].any() assert [0, 1].any() assert ![0, 0].any()
self
- the object over which we iterateCoerce an object instance to a boolean value. An object is coerced to true if it's not null, to false if it is null.
object
- the object to coerceCoerce a Boolean instance to a boolean value.
bool
- the BooleanCoerce a collection instance to a boolean value. A collection is coerced to false if it's empty, and to true otherwise.
assert [1,2].asBoolean() == true
assert [].asBoolean() == false
collection
- the collectionCoerce a map instance to a boolean value. A map is coerced to false if it's empty, and to true otherwise.
assert [:] as Boolean == false assert [a:2] as Boolean == true
map
- the mapCoerce an iterator instance to a boolean value. An iterator is coerced to false if there are no more elements to iterate over, and to true otherwise.
iterator
- the iteratorCoerce an enumeration instance to a boolean value. An enumeration is coerced to false if there are no more elements to enumerate, and to true otherwise.
enumeration
- the enumerationCoerce an Object array to a boolean value. An Object array is false if the array is of length 0. and to true otherwise
array
- the arrayCoerces a byte array to a boolean value. A byte array is false if the array is of length 0, and true otherwise.
array
- an arrayCoerces a short array to a boolean value. A short array is false if the array is of length 0, and true otherwise.
array
- an arrayCoerces an int array to a boolean value. An int array is false if the array is of length 0, and true otherwise.
array
- an arrayCoerces a long array to a boolean value. A long array is false if the array is of length 0, and true otherwise.
array
- an arrayCoerces a float array to a boolean value. A float array is false if the array is of length 0, and true otherwise.
array
- an arrayCoerces a double array to a boolean value. A double array is false if the array is of length 0, and true otherwise.
array
- an arrayCoerces a boolean array to a boolean value. A boolean array is false if the array is of length 0, and true otherwise.
array
- an arrayCoerces a char array to a boolean value. A char array is false if the array is of length 0, and true otherwise.
array
- an arrayCoerce a character to a boolean value. A character is coerced to false if it's character value is equal to 0, and to true otherwise.
character
- the characterCoerce a number to a boolean value. A number is coerced to false if its double value is equal to 0, and to true otherwise, and to true otherwise.
number
- the numberConverts this Iterable to a Collection. Returns the original Iterable if it is already a Collection.
Example usage:
assert new HashSet().asCollection() instanceof Collection
self
- an Iterable to be converted into a CollectionA convenience method for creating an immutable map.
self
- a MapA convenience method for creating an immutable sorted map.
self
- a SortedMapA convenience method for creating an immutable list
self
- a ListA convenience method for creating an immutable list.
self
- a SetA convenience method for creating an immutable sorted set.
self
- a SortedSetA convenience method for creating an immutable Collection.
def mutable = [1,2,3] def immutable = mutable.asImmutable() mutable << 4 try { immutable << 4 assert false } catch (UnsupportedOperationException) { assert true }
self
- a CollectionConverts this Iterable to a List. Returns the original Iterable if it is already a List.
Example usage:
assert new HashSet().asList() instanceof List
self
- an Iterable to be converted into a ListA convenience method for creating a synchronized Map.
self
- a MapA convenience method for creating a synchronized SortedMap.
self
- a SortedMapA convenience method for creating a synchronized Collection.
self
- a CollectionA convenience method for creating a synchronized List.
self
- a ListA convenience method for creating a synchronized Set.
self
- a SetA convenience method for creating a synchronized SortedSet.
self
- a SortedSetConverts the given iterable to another type.
iterable
- a Iterableclazz
- the desired classConverts the given collection to another type. A default concrete type is used for List, Set, or SortedSet. If the given type has a constructor taking a collection, that is used. Otherwise, the call is deferred to asType(Object,Class). If this collection is already of the given type, the same instance is returned.
col
- a collectionclazz
- the desired classConverts the given array to either a List, Set, or SortedSet. If the given class is something else, the call is deferred to asType(Object,Class).
ary
- an arrayclazz
- the desired classCoerces the closure to an implementation of the given class. The class is assumed to be an interface or class with a single method definition. The closure is used as the implementation of that single method.
cl
- the implementation of the single methodclazz
- the target typeCoerces this map to the given type, using the map's keys as the public method names, and values as the implementation. Typically the value would be a closure which behaves like the method implementation.
map
- this mapclazz
- the target typeTransform this number to a the given type, using the 'as' operator. The following types are supported in addition to the default asType(java.lang.Object, java.lang.Class):
self
- this numberc
- the desired type of the transformed resultConverts a given object to a type. This method is used through the "as" operator and is overloadable as any other operator.
obj
- the object to converttype
- the goal typeBitwise NEGATE a BitSet.
self
- a BitSetBitwise NEGATE a Number.
left
- a Number Collates this iterable into sub-lists of length size
.
Example:
def list = [ 1, 2, 3, 4, 5, 6, 7 ] def coll = list.collate( 3 ) assert coll == [ [ 1, 2, 3 ], [ 4, 5, 6 ], [ 7 ] ]
self
- an Iterablesize
- the length of each sub-list in the returned list Collates this iterable into sub-lists of length size
stepping through the code step
elements for each subList.
Example:
def list = [ 1, 2, 3, 4 ] def coll = list.collate( 3, 1 ) assert coll == [ [ 1, 2, 3 ], [ 2, 3, 4 ], [ 3, 4 ], [ 4 ] ]
self
- an Iterablesize
- the length of each sub-list in the returned liststep
- the number of elements to step through for each sub-list Collates this iterable into sub-lists of length size
. Any remaining elements in
the iterable after the subdivision will be dropped if keepRemainder
is false.
Example:
def list = [ 1, 2, 3, 4, 5, 6, 7 ] def coll = list.collate( 3, false ) assert coll == [ [ 1, 2, 3 ], [ 4, 5, 6 ] ]
self
- an Iterablesize
- the length of each sub-list in the returned listkeepRemainder
- if true, any remaining elements are returned as sub-lists. Otherwise they are discarded Collates this iterable into sub-lists of length size
stepping through the code step
elements for each sub-list. Any remaining elements in the iterable after the subdivision will be dropped if
keepRemainder
is false.
Example:
def list = [ 1, 2, 3, 4 ] assert list.collate( 2, 2, true ) == [ [ 1, 2 ], [ 3, 4 ] ] assert list.collate( 3, 1, true ) == [ [ 1, 2, 3 ], [ 2, 3, 4 ], [ 3, 4 ], [ 4 ] ] assert list.collate( 3, 1, false ) == [ [ 1, 2, 3 ], [ 2, 3, 4 ] ]
self
- an Iterablesize
- the length of each sub-list in the returned liststep
- the number of elements to step through for each sub-listkeepRemainder
- if true, any remaining elements are returned as sub-lists. Otherwise they are discarded Iterates through this aggregate Object transforming each item into a new value using the
transform
closure, returning a list of transformed values.
Example:
def list = [1, 'a', 1.23, true ] def types = list.collect { it.class } assert types == [Integer, String, BigDecimal, Boolean]
self
- an aggregate Object with an Iterator returning its itemstransform
- the closure used to transform each item of the aggregate objectIterates through this aggregate Object transforming each item into a new value using Closure.IDENTITY as a transformer, basically returning a list of items copied from the original object.
assert [1,2,3] == [1,2,3].iterator().collect()
self
- an aggregate Object with an Iterator returning its items Iterates through this aggregate Object transforming each item into a new value using the transform
closure
and adding it to the supplied collector
.
self
- an aggregate Object with an Iterator returning its itemscollector
- the Collection to which the transformed values are addedtransform
- the closure used to transform each item of the aggregate object Iterates through this collection transforming each entry into a new value using the transform
closure
returning a list of transformed values.
assert [2,4,6] == [1,2,3].collect { it * 2 }
self
- a collectiontransform
- the closure used to transform each item of the collectionIterates through this collection transforming each entry into a new value using Closure.IDENTITY as a transformer, basically returning a list of items copied from the original collection.
assert [1,2,3] == [1,2,3].collect()
self
- a collection Iterates through this collection transforming each value into a new value using the transform
closure
and adding it to the supplied collector
.
assert [1,2,3] as HashSet == [2,4,5,6].collect(new HashSet()) { (int)(it / 2) }
self
- a collectioncollector
- the Collection to which the transformed values are addedtransform
- the closure used to transform each item of the collection Iterates through this Map transforming each map entry into a new value using the transform
closure
returning the collector
with all transformed values added to it.
assert [a:1, b:2].collect( [] as HashSet ) { key, value -> key*value } == ["a", "bb"] as Set assert [3:20, 2:30].collect( [] as HashSet ) { entry -> entry.key * entry.value } == [60] as Set
self
- a Mapcollector
- the Collection to which transformed values are addedtransform
- the transformation closure which can take one (Map.Entry) or two (key, value) parameters Iterates through this Map transforming each map entry into a new value using the transform
closure
returning a list of transformed values.
assert [a:1, b:2].collect { key, value -> key*value } == ["a", "bb"] assert [3:20, 2:30].collect { entry -> entry.key * entry.value } == [60, 60]
self
- a Maptransform
- the transformation closure which can take one (Map.Entry) or two (key, value) parametersDeprecated alias for collectNested
Deprecated alias for collectNested
Iterates through this Map transforming each map entry using the transform
closure
returning a map of the transformed entries.
assert [a:1, b:2].collectEntries( [:] ) { k, v -> [v, k] } == [1:'a', 2:'b'] assert [a:1, b:2].collectEntries( [30:'C'] ) { key, value -> [(value*10): key.toUpperCase()] } == [10:'A', 20:'B', 30:'C']Note: When using the list-style of result, the behavior is '
def (key, value) = listResultFromClosure
'.
While we strongly discourage using a list of size other than 2, Groovy's normal semantics apply in this case;
throwing away elements after the second one and using null for the key or value for the case of a shortened list.
If your collector Map doesn't support null keys or values, you might get a runtime error, e.g. NullPointerException or IllegalArgumentException.
self
- a Mapcollector
- the Map into which the transformed entries are puttransform
- the closure used for transforming, which can take one (Map.Entry) or two (key, value) parameters and
should return a Map.Entry, a Map or a two-element list containing the resulting key and value Iterates through this Map transforming each entry using the transform
closure
and returning a map of the transformed entries.
assert [a:1, b:2].collectEntries { key, value -> [value, key] } == [1:'a', 2:'b'] assert [a:1, b:2].collectEntries { key, value -> [(value*10): key.toUpperCase()] } == [10:'A', 20:'B']Note: When using the list-style of result, the behavior is '
def (key, value) = listResultFromClosure
'.
While we strongly discourage using a list of size other than 2, Groovy's normal semantics apply in this case;
throwing away elements after the second one and using null for the key or value for the case of a shortened list.
If your Map doesn't support null keys or values, you might get a runtime error, e.g. NullPointerException or IllegalArgumentException.
self
- a Maptransform
- the closure used for transforming, which can take one (Map.Entry) or two (key, value) parameters and
should return a Map.Entry, a Map or a two-element list containing the resulting key and valueA variant of collectEntries for Iterators.
self
- an Iteratortransform
- the closure used for transforming, which has an item from self as the parameter and
should return a Map.Entry, a Map or a two-element list containing the resulting key and value Iterates through this Iterable transforming each item using the transform
closure
and returning a map of the resulting transformed entries.
def letters = "abc" // collect letters with index using list style assert (0..2).collectEntries { index -> [index, letters[index]] } == [0:'a', 1:'b', 2:'c'] // collect letters with index using map style assert (0..2).collectEntries { index -> [(index): letters[index]] } == [0:'a', 1:'b', 2:'c']Note: When using the list-style of result, the behavior is '
def (key, value) = listResultFromClosure
'.
While we strongly discourage using a list of size other than 2, Groovy's normal semantics apply in this case;
throwing away elements after the second one and using null for the key or value for the case of a shortened list.
self
- an Iterabletransform
- the closure used for transforming, which has an item from self as the parameter and
should return a Map.Entry, a Map or a two-element list containing the resulting key and valueA variant of collectEntries for Iterators using the identity closure as the transform.
self
- an Iterator A variant of collectEntries for Iterable objects using the identity closure as the transform.
The source Iterable should contain a list of [key, value]
tuples or Map.Entry
objects.
def nums = [1, 10, 100, 1000] def tuples = nums.collect{ [it, it.toString().size()] } assert tuples == [[1, 1], [10, 2], [100, 3], [1000, 4]] def map = tuples.collectEntries() assert map == [1:1, 10:2, 100:3, 1000:4]
self
- an IterableA variant of collectEntries for Iterators using a supplied map as the destination of transformed entries.
self
- an Iteratorcollector
- the Map into which the transformed entries are puttransform
- the closure used for transforming, which has an item from self as the parameter and
should return a Map.Entry, a Map or a two-element list containing the resulting key and valueIterates through this Iterable transforming each item using the closure as a transformer into a map entry, returning the supplied map with all of the transformed entries added to it.
def letters = "abc" // collect letters with index assert (0..2).collectEntries( [:] ) { index -> [index, letters[index]] } == [0:'a', 1:'b', 2:'c'] assert (0..2).collectEntries( [4:'d'] ) { index -> [(index+1): letters[index]] } == [1:'a', 2:'b', 3:'c', 4:'d']Note: When using the list-style of result, the behavior is '
def (key, value) = listResultFromClosure
'.
While we strongly discourage using a list of size other than 2, Groovy's normal semantics apply in this case;
throwing away elements after the second one and using null for the key or value for the case of a shortened list.
If your collector Map doesn't support null keys or values, you might get a runtime error, e.g. NullPointerException or IllegalArgumentException.
self
- an Iterablecollector
- the Map into which the transformed entries are puttransform
- the closure used for transforming, which has an item from self as the parameter and
should return a Map.Entry, a Map or a two-element list containing the resulting key and valueA variant of collectEntries for Iterators using the identity closure as the transform and a supplied map as the destination of transformed entries.
self
- an Iteratorcollector
- the Map into which the transformed entries are putA variant of collectEntries for Iterables using the identity closure as the transform and a supplied map as the destination of transformed entries.
self
- an Iterablecollector
- the Map into which the transformed entries are put Iterates through this array transforming each item using the transform
closure
and returning a map of the resulting transformed entries.
def letters = "abc" def nums = [0, 1, 2] as Integer[] // collect letters with index assert nums.collectEntries( [:] ) { index -> [index, letters[index]] } == [0:'a', 1:'b', 2:'c'] assert nums.collectEntries( [4:'d'] ) { index -> [(index+1): letters[index]] } == [1:'a', 2:'b', 3:'c', 4:'d']Note: When using the list-style of result, the behavior is '
def (key, value) = listResultFromClosure
'.
While we strongly discourage using a list of size other than 2, Groovy's normal semantics apply in this case;
throwing away elements after the second one and using null for the key or value for the case of a shortened list.
If your collector Map doesn't support null keys or values, you might get a runtime error, e.g. NullPointerException or IllegalArgumentException.
self
- an arraycollector
- the Map into which the transformed entries are puttransform
- the closure used for transforming, which has an item from self as the parameter and
should return a Map.Entry, a Map or a two-element list containing the resulting key and valueA variant of collectEntries using the identity closure as the transform.
self
- an arraycollector
- the Map into which the transformed entries are put Iterates through this array transforming each item using the transform
closure
and returning a map of the resulting transformed entries.
def letters = "abc" def nums = [0, 1, 2] as Integer[] // collect letters with index using list style assert nums.collectEntries { index -> [index, letters[index]] } == [0:'a', 1:'b', 2:'c'] // collect letters with index using map style assert nums.collectEntries { index -> [(index): letters[index]] } == [0:'a', 1:'b', 2:'c']Note: When using the list-style of result, the behavior is '
def (key, value) = listResultFromClosure
'.
While we strongly discourage using a list of size other than 2, Groovy's normal semantics apply in this case;
throwing away elements after the second one and using null for the key or value for the case of a shortened list.
self
- a Collectiontransform
- the closure used for transforming, which has an item from self as the parameter and
should return a Map.Entry, a Map or a two-element list containing the resulting key and valueA variant of collectEntries using the identity closure as the transform.
self
- an arrayProjects each item from a source Iterable to a collection and concatenates (flattens) the resulting collections into a single list.
def nums = 1..10 def squaresAndCubesOfEvens = nums.collectMany{ it % 2 ? [] : [it**2, it**3] } assert squaresAndCubesOfEvens == [4, 8, 16, 64, 36, 216, 64, 512, 100, 1000] def animals = ['CAT', 'DOG', 'ELEPHANT'] as Set def smallAnimals = animals.collectMany{ it.size() > 3 ? [] : [it.toLowerCase()] } assert smallAnimals == ['cat', 'dog'] def orig = nums as Set def origPlusIncrements = orig.collectMany{ [it, it+1] } assert origPlusIncrements.size() == orig.size() * 2 assert origPlusIncrements.unique().size() == orig.size() + 1
self
- an Iterableprojection
- a projecting Closure returning a collection of items Projects each item from a source collection to a result collection and concatenates (flattens) the resulting
collections adding them into the collector
.
def animals = ['CAT', 'DOG', 'ELEPHANT'] as Set def smallAnimals = animals.collectMany(['ant', 'bee']){ it.size() > 3 ? [] : [it.toLowerCase()] } assert smallAnimals == ['ant', 'bee', 'cat', 'dog'] def nums = 1..5 def origPlusIncrements = nums.collectMany([] as Set){ [it, it+1] } assert origPlusIncrements.size() == nums.size() + 1
self
- an Iterablecollector
- an initial collection to add the projected items toprojection
- a projecting Closure returning a collection of items Projects each item from a source map to a result collection and concatenates (flattens) the resulting
collections adding them into the collector
.
def map = [bread:3, milk:5, butter:2] def result = map.collectMany(['x']){ k, v -> k.startsWith('b') ? k.toList() : [] } assert result == ['x', 'b', 'r', 'e', 'a', 'd', 'b', 'u', 't', 't', 'e', 'r']
self
- a mapcollector
- an initial collection to add the projected items toprojection
- a projecting Closure returning a collection of itemsProjects each item from a source map to a result collection and concatenates (flattens) the resulting collections adding them into a collection.
def map = [bread:3, milk:5, butter:2] def result = map.collectMany{ k, v -> k.startsWith('b') ? k.toList() : [] } assert result == ['b', 'r', 'e', 'a', 'd', 'b', 'u', 't', 't', 'e', 'r']
self
- a mapprojection
- a projecting Closure returning a collection of itemsProjects each item from a source array to a collection and concatenates (flattens) the resulting collections into a single list.
def nums = [1, 2, 3, 4, 5, 6] as Object[] def squaresAndCubesOfEvens = nums.collectMany{ it % 2 ? [] : [it**2, it**3] } assert squaresAndCubesOfEvens == [4, 8, 16, 64, 36, 216]
self
- an arrayprojection
- a projecting Closure returning a collection of itemsProjects each item from a source iterator to a collection and concatenates (flattens) the resulting collections into a single list.
def numsIter = [1, 2, 3, 4, 5, 6].iterator() def squaresAndCubesOfEvens = numsIter.collectMany{ it % 2 ? [] : [it**2, it**3] } assert squaresAndCubesOfEvens == [4, 8, 16, 64, 36, 216]
self
- an iteratorprojection
- a projecting Closure returning a collection of itemsRecursively iterates through this collection transforming each non-Collection value into a new value using the closure as a transformer. Returns a potentially nested list of transformed values.
assert [2,[4,6],[8],[]] == [1,[2,3],[4],[]].collectNested { it * 2 }
self
- a collectiontransform
- the closure used to transform each item of the collectionRecursively iterates through this Iterable transforming each non-Collection value into a new value using the closure as a transformer. Returns a potentially nested list of transformed values.
assert [2,[4,6],[8],[]] == [1,[2,3],[4],[]].collectNested { it * 2 }
self
- an Iterabletransform
- the closure used to transform each item of the Iterable Recursively iterates through this Iterable transforming each non-Collection value
into a new value using the transform
closure. Returns a potentially nested
collection of transformed values.
def x = [1,[2,3],[4],[]].collectNested(new Vector()) { it * 2 } assert x == [2,[4,6],[8],[]] assert x instanceof Vector
self
- an Iterablecollector
- an initial Collection to which the transformed values are addedtransform
- the closure used to transform each element of the IterableAdds GroovyCollections#combinations(Iterable) as a method on Iterables.
Example usage:
assert [['a', 'b'],[1, 2, 3]].combinations() == [['a', 1], ['b', 1], ['a', 2], ['b', 2], ['a', 3], ['b', 3]]
self
- an Iterable of collectionsAdds GroovyCollections#combinations(Iterable, Closure) as a method on collections.
Example usage:
assert [[2, 3],[4, 5, 6]].combinations {x,y -> x*y } == [8, 12, 10, 15, 12, 18]
self
- a Collection of listsfunction
- a closure to be called on each combinationCompare a Character and a Number. The ordinal value of the Character is used in the comparison (the ordinal value is the unicode value which for simple character sets is the ASCII value).
left
- a Characterright
- a NumberCompare a Number and a Character. The ordinal value of the Character is used in the comparison (the ordinal value is the unicode value which for simple character sets is the ASCII value).
left
- a Numberright
- a CharacterCompare two Characters. The ordinal values of the Characters are compared (the ordinal value is the unicode value which for simple character sets is the ASCII value).
left
- a Characterright
- a CharacterCompare two Numbers. Equality (==) for numbers dispatches to this.
left
- a Numberright
- another Number to compare toReturns true if this iterable contains the item.
self
- an Iterable to be checked for containmentitem
- an Object to be checked for containment in this iterableChecks whether the array contains the given value.
self
- the array we are searchingvalue
- the value being searched forChecks whether the array contains the given value.
self
- the array we are searchingvalue
- the value being searched forChecks whether the array contains the given value.
self
- the array we are searchingvalue
- the value being searched forChecks whether the array contains the given value.
self
- the array we are searchingvalue
- the value being searched forChecks whether the array contains the given value.
self
- the array within which we count the number of occurrencesvalue
- the value being searched forChecks whether the array contains the given value.
self
- the array we are searchingvalue
- the value being searched forChecks whether the array contains the given value.
self
- the array we are searchingvalue
- the value being searched forChecks whether the array contains the given value.
self
- the array we are searchingvalue
- the value being searched forChecks whether the array contains the given value.
self
- the array we are searchingvalue
- the value being searched forReturns true if this iterable contains all of the elements in the specified array.
self
- an Iterable to be checked for containmentitems
- array to be checked for containment in this iterable Counts the number of occurrences of the given value from the
items within this Iterator.
Comparison is done using Groovy's == operator (using
compareTo(value) == 0
or equals(value)
).
The iterator will become exhausted of elements after determining the count value.
self
- the Iterator from which we count the number of matching occurrencesvalue
- the value being searched forCounts the number of occurrences which satisfy the given closure from the items within this Iterator. The iterator will become exhausted of elements after determining the count value.
Example usage:
assert [2,4,2,1,3,5,2,4,3].toSet().iterator().count{ it % 2 == 0 } == 2
self
- the Iterator from which we count the number of matching occurrencesclosure
- a closure condition Counts the number of occurrences of the given value inside this Iterable.
Comparison is done using Groovy's == operator (using
compareTo(value) == 0
or equals(value)
).
Example usage:
assert [2,4,2,1,3,5,2,4,3].count(4) == 2
self
- the Iterable within which we count the number of occurrencesvalue
- the value being searched forCounts the number of occurrences which satisfy the given closure from inside this Iterable.
Example usage:
assert [2,4,2,1,3,5,2,4,3].count{ it % 2 == 0 } == 5
self
- the Iterable within which we count the number of occurrencesclosure
- a closure conditionCounts the number of occurrences which satisfy the given closure from inside this map. If the closure takes one parameter then it will be passed the Map.Entry. Otherwise, the closure should take two parameters and will be passed the key and value.
Example usage:
assert [a:1, b:1, c:2, d:2].count{ k,v -> k == 'a' || v == 2 } == 3
self
- the map within which we count the number of occurrencesclosure
- a 1 or 2 arg Closure condition applying on the entries Counts the number of occurrences of the given value inside this array.
Comparison is done using Groovy's == operator (using
compareTo(value) == 0
or equals(value)
).
self
- the array within which we count the number of occurrencesvalue
- the value being searched forCounts the number of occurrences which satisfy the given closure from inside this array.
self
- the array within which we count the number of occurrencesclosure
- a closure condition Counts the number of occurrences of the given value inside this array.
Comparison is done using Groovy's == operator (using
compareTo(value) == 0
or equals(value)
).
self
- the array within which we count the number of occurrencesvalue
- the value being searched for