commonMain.implementations.immutableList.BufferIterator.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of kotlinx-collections-immutable Show documentation
Show all versions of kotlinx-collections-immutable Show documentation
Kotlin Immutable Collections multiplatform library
/*
* Copyright 2016-2019 JetBrains s.r.o.
* Use of this source code is governed by the Apache 2.0 License that can be found in the LICENSE.txt file.
*/
package kotlinx.collections.immutable.implementations.immutableList
internal class BufferIterator(
private val buffer: Array,
index: Int,
size: Int
) : AbstractListIterator(index, size) {
override fun next(): T {
if (!hasNext()) {
throw NoSuchElementException()
}
return buffer[index++]
}
override fun previous(): T {
if (!hasPrevious()) {
throw NoSuchElementException()
}
return buffer[--index]
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy