|
Groovy JDK |
Method Summary | |
---|---|
int
|
count(Object value)
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
|
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
determining the resulting conjoined value
|
Object
|
max()
Adds max() method to Iterator objects exhausted of elements after determining the maximum value |
Object
|
max(Closure closure)
Selects the maximum value found from the Iterator using the given closure as a comparator number) for each item passed exhausted of elements after this operation |
Object
|
max(Comparator comparator)
Selects the maximum value found from the Iterator using the given comparator |
Object
|
min()
Adds min() method to Iterator objects exhausted of elements after determining the minimum value |
Object
|
min(Comparator comparator)
Selects the minimum value found from the Iterator using the given comparator |
Object
|
min(Closure closure)
Selects the minimum value found from the Iterator using the given closure as a comparator number) for each item passed exhausted of elements after this operation |
Iterator
|
reverse()
Reverses the iterator exhausted of elements after determining the reversed values A new iterator for iterating through the reversed values is returned |
int
|
size()
Provide the standard Groovy size() method for Iterator
The iterator will become exhausted of elements after determining the size value
|
Iterator
|
sort()
Sorts the given iterator items into a sorted iterator assumed to be comparable exhausted of elements after completing this method call is produced that traverses the items in sorted order |
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 "plus" method on all items from the Iterator exhausted of elements after determining the sum value |
Object
|
sum(Object initialValue)
Sums the items from an Iterator "plus" method on all items from the Iterator |
List
|
toList()
Convert an iterator to a List exhausted of elements after making this conversion |
Iterator
|
unique()
Returns an iterator equivalent to this iterator all duplicated items removed by using the default comparator exhausted of elements after determining the unique values for the unique values will be returned |
Iterator
|
unique(Closure closure)
Returns an iterator equivalent to this iterator all duplicated items removed by using a closure as a comparator single parameter, the argument passed will be each element, and the closure should return a value used for comparison (either using {@link Comparable#compareTo(Object)} or Object#equals() ) |
Iterator
|
unique(Comparator comparator)
Returns an iterator equivalent to this iterator with all duplicated items removed by using the supplied comparator |
Method Detail |
---|
public int 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 Object max()
public Object max(Closure closure)
closure
- a closure used as a comparator.
public Object max(Comparator comparator)
comparator
- a Comparator.
public Object min()
public Object min(Comparator comparator)
comparator
- a Comparator.
public Object 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 |