diff options
author | Jake Wharton <jw@squareup.com> | 2024-02-05 09:57:08 -0500 |
---|---|---|
committer | Jake Wharton <jw@squareup.com> | 2024-02-05 09:57:08 -0500 |
commit | a88cd34f13d02fc2b648fd23c944042a33c3256c (patch) | |
tree | f6adafe7e13c1168719852ca73d8cd34ae98a084 | |
parent | 8b54035253c4be8dd28c0eebc171e525b77fd4db (diff) | |
download | okio-a88cd34f13d02fc2b648fd23c944042a33c3256c.tar.gz |
Reduce intermediate allocations when create Options
-rw-r--r-- | okio/src/commonMain/kotlin/okio/Options.kt | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/okio/src/commonMain/kotlin/okio/Options.kt b/okio/src/commonMain/kotlin/okio/Options.kt index e8dae6e1..6c130218 100644 --- a/okio/src/commonMain/kotlin/okio/Options.kt +++ b/okio/src/commonMain/kotlin/okio/Options.kt @@ -40,7 +40,7 @@ class Options private constructor( // indexes to the caller's indexes. val list = byteStrings.toMutableList() list.sort() - val indexes = mutableListOf(*byteStrings.map { -1 }.toTypedArray()) + val indexes = MutableList(list.size) { -1 } byteStrings.forEachIndexed { callerIndex, byteString -> val sortedIndex = list.binarySearch(byteString) indexes[sortedIndex] = callerIndex |