wei-k.iarray_2.11.0.4.0.source-code.IArrayIterator.scala Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of iarray_2.11 Show documentation
Show all versions of iarray_2.11 Show documentation
Immutable array wrapper. does not use ClassTag. scalaz friendly
package iarray
private final class IArrayIterator[A](array: Array[AnyRef]) extends Iterator[A] {
private[this] var i = 0
def hasNext = i < array.length
def next(): A =
if (hasNext) {
val r = array(i).asInstanceOf[A]
i += 1
r
} else Iterator.empty.next
}