[K/N] Use AbstractList.checkIndex() functions instead of custom check functions

This commit is contained in:
Abduqodiri Qurbonzoda
2023-05-31 00:57:21 +03:00
committed by Space Team
parent 89d1cfe05b
commit 3917ec94ab
4 changed files with 26 additions and 77 deletions
@@ -24,12 +24,3 @@ internal fun insertInt(array: CharArray, start: Int, value: Int): Int {
insertString(array, start, valueString, 0, length)
return length
}
internal fun checkBoundsIndexes(startIndex: Int, endIndex: Int, size: Int) {
if (startIndex < 0 || endIndex > size) {
throw IndexOutOfBoundsException("startIndex: $startIndex, endIndex: $endIndex, size: $size")
}
if (startIndex > endIndex) {
throw IllegalArgumentException("startIndex: $startIndex > endIndex: $endIndex")
}
}