SyncIterator

interface SyncIterator<T>

An iterator over a collection. Allows to sequentially access the elements. Must be closed at the end to cleanup resources.

Instances of this interface are not thread-safe and shall not be used from concurrent coroutines.

See also

Example 1:

val iterator = map.iterator()
try {
while (iterator.hasNext()) {
println(iterator.next())
}
} finally {
iterator.close()
}

Example 2:

map.queryItems().forEach { item ->
put(item.key, item.data())
}

Example 3:

val allItems = map.queryItems().asFlow().toList()

Functions

Link copied to clipboard
fun <T> SyncIterator<T>.asFlow(): <Error class: unknown class>
Link copied to clipboard
inline suspend fun <T> SyncIterator<T>.forEach(block: (T) -> Unit)
Link copied to clipboard
abstract suspend operator fun hasNext(): Boolean

This function retrieves and removes an element for the subsequent invocation of next.

Link copied to clipboard
abstract operator fun next(): T