Skip to content
This repository has been archived by the owner on Aug 10, 2024. It is now read-only.

Commit

Permalink
kdoc
Browse files Browse the repository at this point in the history
  • Loading branch information
sanity committed Nov 11, 2022
1 parent 553599f commit 3a92fa1
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions src/main/kotlin/kweb/state/ObservableList.kt
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,12 @@ class ObservableList<ITEM : Any>(
return items.isEmpty()
}

/**
* Returns an iterator over the elements in this list (in proper sequence).
*
* **IMPORTANT:** The returned iterator will throw an UnsupportedOperationException
* if you attempt to call [MutableIterator.remove].
*/
override fun iterator(): MutableIterator<ITEM> {
return listIterator()
}
Expand Down Expand Up @@ -170,8 +176,25 @@ class ObservableList<ITEM : Any>(
}
}

/**
* Returns a list iterator over the elements in this list (in proper sequence).
*
* **IMPORTANT:** The returned iterator will throw an UnsupportedOperationException
* if you attempt to call [MutableListIterator.add], [MutableListIterator.set], or
* [MutableListIterator.remove]. Implementing these in a threadsafe manner is
* difficult, and they are not needed for the intended use of this class.
*/
override fun listIterator(): MutableListIterator<ITEM> = listIterator(0)

/**
* Returns a list iterator over the elements in this list (in proper sequence),
* starting at the specified position.
*
* **IMPORTANT:** The returned iterator will throw an UnsupportedOperationException
* if you attempt to call [MutableListIterator.add], [MutableListIterator.set], or
* [MutableListIterator.remove]. Implementing these in a threadsafe manner is
* difficult, and they are not needed for the intended use of this class.
*/
override fun listIterator(index: Int): MutableListIterator<ITEM> {
if (closed) {
throw IllegalStateException("Cannot read closed ObservableList")
Expand Down

0 comments on commit 3a92fa1

Please sign in to comment.