From 3a92fa1a47e9b637b0c4d8939e08f5f47d75ed9a Mon Sep 17 00:00:00 2001 From: Ian Clarke Date: Fri, 11 Nov 2022 14:47:00 -0600 Subject: [PATCH] kdoc --- src/main/kotlin/kweb/state/ObservableList.kt | 23 ++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/src/main/kotlin/kweb/state/ObservableList.kt b/src/main/kotlin/kweb/state/ObservableList.kt index e50ef1fdce..1766327b23 100644 --- a/src/main/kotlin/kweb/state/ObservableList.kt +++ b/src/main/kotlin/kweb/state/ObservableList.kt @@ -129,6 +129,12 @@ class ObservableList( 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 { return listIterator() } @@ -170,8 +176,25 @@ class ObservableList( } } + /** + * 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 = 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 { if (closed) { throw IllegalStateException("Cannot read closed ObservableList")