|
Groovy JDK |
Method Summary | |
---|---|
Number
|
count(Object value)
Counts the number of occurrences of the given value from the items within this Iterator. |
Object
|
inject(Object value, Closure closure)
Iterates through the given iterator, passing in the initial value to the closure along with the current iterated item then passing into the next iteration the value of the previous closure. |
Iterator
|
iterator()
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. |
String
|
join(String separator)
Concatenates the toString() representation of each
item from the iterator, with the given String as a separator between
each item.
|
T
|
max()
Adds max() method to Iterator objects. |
T
|
max(Closure closure)
Selects the maximum value found from the Iterator using the given closure as a comparator. |
T
|
max(Comparator comparator)
Selects the maximum value found from the Iterator using the given comparator. |
T
|
min()
Adds min() method to Iterator objects. |
T
|
min(Comparator comparator)
Selects the minimum value found from the Iterator using the given comparator. |
T
|
min(Closure closure)
Selects the minimum value found from the Iterator using the given closure as a comparator. |
Iterator
|
reverse()
Reverses the iterator. |
int
|
size()
Provide the standard Groovy size() method for Iterator .
|
Iterator
|
sort()
Sorts the given iterator items into a sorted iterator. |
Iterator
|
sort(Comparator comparator)
Sorts the given iterator items into a sorted iterator using the comparator. |
Iterator
|
sort(Closure closure)
Sorts the given iterator items into a sorted iterator using the closure as a comparator. |
Object
|
sum()
Sums the items from an Iterator. |
Object
|
sum(Object initialValue)
Sums the items from an Iterator. |
List
|
toList()
Convert an iterator to a List. |
Iterator
|
unique()
Returns an iterator equivalent to this iterator all duplicated items removed by using the default comparator. |
Iterator
|
unique(Closure closure)
Returns an iterator equivalent to this iterator all duplicated items removed by using a closure as a comparator. |
Iterator
|
unique(Comparator comparator)
Returns an iterator equivalent to this iterator with all duplicated items removed by using the supplied comparator. |
Method Detail |
---|
public Number count(Object value)
compareTo(value) == 0
or equals(value)
).
The iterator will become exhausted of elements after determining the count value.value
- the value being searched for.public Object inject(Object value, Closure closure)
value
- a value.closure
- a closure.public Iterator iterator()
public String join(String separator)
toString()
representation of each
item from the iterator, with the given String as a separator between
each item. The iterator will become exhausted of elements after
determining the resulting conjoined value.separator
- a String separator.public T max()
public T max(Closure closure)
closure
- a closure used as a comparator.public T max(Comparator comparator)
comparator
- a Comparator.public T min()
public T min(Comparator comparator)
comparator
- a Comparator.public T min(Closure closure)
closure
- a closure used as a comparator.public Iterator reverse()
public int size()
size()
method for Iterator
.
The iterator will become exhausted of elements after determining the size value.public Iterator sort()
public Iterator sort(Comparator comparator)
comparator
- a Comparator used for comparing items.public Iterator sort(Closure closure)
closure
- a Closure used as a comparator.public Object sum()
public Object sum(Object initialValue)
initialValue
- the items in the collection will be summed to this initial value.public List toList()
public Iterator unique()
public Iterator unique(Closure closure)
closure
- a Closure used as a comparator.public Iterator unique(Comparator comparator)
comparator
- a Comparator.
|
Groovy JDK |