E - the type of the elementspublic class RubyEnumerator<E> extends RubyEnumerable<E> implements Ruby.Enumerator<E>
RubyEnumerator implements most of the methods refer to the Enumerator
class of Ruby language.
RubyEnumerator is both Iterable and Iterator and it's also a peeking
iterator and a Ruby.Enumerable.
| Constructor and Description |
|---|
RubyEnumerator(java.lang.Iterable<E> iterable)
Creates a
RubyEnumerator by given Iterable. |
| Modifier and Type | Method and Description |
|---|---|
static <E> RubyEnumerator<E> |
copyOf(java.lang.Iterable<E> iter)
Returns a
RubyEnumerator which copies the elements of given
Iterable. |
RubyEnumerator<E> |
each(Block<? super E> block)
Yields each element to the block.
|
protected java.lang.Iterable<E> |
getIterable()
Returns an Iterable of elements.
|
boolean |
hasNext() |
java.util.Iterator<E> |
iterator() |
E |
next() |
static <E> RubyEnumerator<E> |
of(java.lang.Iterable<E> iter)
Returns a
RubyEnumerator which wraps the given Iterable. |
E |
peek()
Returns the next element without advancing the iteration.
|
void |
remove() |
RubyEnumerator<E> |
rewind()
Rewinds this Iterator to the beginning.
|
java.lang.String |
toString() |
allʔ, allʔ, anyʔ, anyʔ, chunk, chunk, collect, collect, collect, collectConcat, collectConcat, count, count, cycle, cycle, cycle, cycle, detect, detect, drop, dropWhile, dropWhile, each, eachCons, eachCons, eachEntry, eachEntry, eachSlice, eachSlice, eachWithIndex, eachWithIndex, eachWithObject, eachWithObject, entries, find, find, findAll, findAll, findIndex, findIndex, findIndex, first, first, flatMap, flatMap, grep, grep, grep, groupBy, groupBy, groupBy, includeʔ, inject, inject, inject, inject, lazy, map, map, map, max, max, maxBy, maxBy, maxBy, maxBy, memberʔ, min, min, minBy, minBy, minBy, minBy, minmax, minmax, minmaxBy, minmaxBy, minmaxBy, minmaxBy, noneʔ, noneʔ, oneʔ, oneʔ, partition, partition, reduce, reduce, reduce, reduce, reject, reject, reverseEach, reverseEach, select, select, sliceBefore, sliceBefore, sort, sortBy, sortBy, sortBy, sortBy, sortBy, take, takeWhile, takeWhile, toA, zip, zip, zipclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitchunk, chunk, collect, collect, collect, collectConcat, collectConcat, cycle, cycle, detect, drop, dropWhile, dropWhile, each, eachCons, eachCons, eachEntry, eachEntry, eachSlice, eachWithIndex, eachWithIndex, eachWithObject, find, findAll, findAll, findIndex, flatMap, flatMap, grep, grep, grep, groupBy, map, map, map, maxBy, minBy, minmaxBy, partition, reject, reject, reverseEach, reverseEach, select, select, sliceBefore, sliceBefore, sortBy, take, takeWhile, takeWhile, zip, zipallʔ, allʔ, anyʔ, anyʔ, count, count, cycle, cycle, detect, eachSlice, eachWithObject, entries, find, findIndex, findIndex, first, first, groupBy, groupBy, includeʔ, inject, inject, inject, inject, lazy, max, max, maxBy, maxBy, maxBy, memberʔ, min, min, minBy, minBy, minBy, minmax, minmax, minmaxBy, minmaxBy, minmaxBy, noneʔ, noneʔ, oneʔ, oneʔ, partition, reduce, reduce, reduce, reduce, sort, sortBy, sortBy, sortBy, sortBy, toA, zippublic RubyEnumerator(java.lang.Iterable<E> iterable)
RubyEnumerator by given Iterable. It's a wrapper
implementation. No defensive copy has been made.iterable - any Iterablejava.lang.NullPointerException - if iterable is nullpublic static <E> RubyEnumerator<E> of(java.lang.Iterable<E> iter)
RubyEnumerator which wraps the given Iterable.iter - any IterableRubyEnumeratorjava.lang.NullPointerException - if iter is nullpublic static <E> RubyEnumerator<E> copyOf(java.lang.Iterable<E> iter)
RubyEnumerator which copies the elements of given
Iterable.iter - any IterableRubyEnumeratorjava.lang.NullPointerException - if iter is nullprotected java.lang.Iterable<E> getIterable()
RubyEnumerablegetIterable in class RubyEnumerable<E>public RubyEnumerator<E> each(Block<? super E> block)
each in interface Ruby.Enumerable<E>each in interface RubyContract.Enumerable<E,Ruby.Enumerator<?>,RubyArray<?>>each in class RubyEnumerable<E>block - to yield each elementRubyEnumeratorpublic RubyEnumerator<E> rewind()
rewind in interface Ruby.Enumerator<E>rewind in interface RubyContract.Enumerator<E,Ruby.Enumerator<?>,RubyArray<?>>RubyEnumeratorpublic E peek()
RubyContract.Enumeratorpeek in interface RubyContract.Enumerator<E,Ruby.Enumerator<?>,RubyArray<?>>public java.util.Iterator<E> iterator()
iterator in interface java.lang.Iterable<E>iterator in class RubyEnumerable<E>public boolean hasNext()
hasNext in interface java.util.Iterator<E>public void remove()
remove in interface java.util.Iterator<E>public java.lang.String toString()
toString in class RubyEnumerable<E>