Skip to content

Commit a88cd34

Browse files
committed
Reduce intermediate allocations when create Options
1 parent 8b54035 commit a88cd34

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

okio/src/commonMain/kotlin/okio/Options.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ class Options private constructor(
4040
// indexes to the caller's indexes.
4141
val list = byteStrings.toMutableList()
4242
list.sort()
43-
val indexes = mutableListOf(*byteStrings.map { -1 }.toTypedArray())
43+
val indexes = MutableList(list.size) { -1 }
4444
byteStrings.forEachIndexed { callerIndex, byteString ->
4545
val sortedIndex = list.binarySearch(byteString)
4646
indexes[sortedIndex] = callerIndex

0 commit comments

Comments
 (0)