Skip to content

Commit f1cf395

Browse files
authored
Update: fix NoSuchElementException description in exceptions doc (#4742)
elementAt() throws an `IndexOutOfBoundsException`, not a `NoSuchElementException`.
1 parent e5aa8ec commit f1cf395

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

docs/topics/exceptions.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -590,7 +590,7 @@ Let's explore some common exception types found in Kotlin, which are all subclas
590590
591591
* [`NoSuchElementException`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-no-such-element-exception/): This exception is thrown when an element that does not exist in a
592592
particular collection is accessed. It occurs when using methods that expect a specific element,
593-
such as [`first()`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/first.html), [`last()`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/last.html), or [`elementAt()`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/element-at.html).
593+
such as [`first()`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/first.html) or [`last()`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/last.html).
594594
595595
```kotlin
596596
val emptyList = listOf<Int>()

0 commit comments

Comments
 (0)