Iterator

interface Iterator

Iterates through a list of Element items asynchronously.

hasNext and hasPrevious refer to the last element computed by a previous call to any of both methods.

Inheritors

Functions

Link copied to clipboard
abstract suspend operator fun hasNext(): Boolean

Returns true if the iterator has a next element, suspending the caller while processing it.

Link copied to clipboard
abstract suspend fun hasPrevious(): Boolean

Returns true if the iterator has a previous element, suspending the caller while processing it.

Link copied to clipboard
abstract operator fun next(): Content.Element

Retrieves the element computed by a preceding call to hasNext, or throws an IllegalStateException if hasNext was not invoked. This method should only be used in pair with hasNext.

Link copied to clipboard
open suspend fun nextOrNull(): Content.Element?

Advances to the next item and returns it, or null if we reached the end.

Link copied to clipboard
abstract fun previous(): Content.Element

Retrieves the element computed by a preceding call to hasPrevious, or throws an IllegalStateException if hasPrevious was not invoked. This method should only be used in pair with hasPrevious.

Link copied to clipboard
open suspend fun previousOrNull(): Content.Element?

Advances to the previous item and returns it, or null if we reached the beginning.