Safer/faster array copy
This commit is contained in:
parent
ee2dfbd40b
commit
1923e54548
@ -48,7 +48,7 @@ class Day08(@Lines val input: Input<List<String>>) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
for (index in possibleMutations.toArray()) {
|
for (index in possibleMutations.toArray()) {
|
||||||
val copy = instructions.clone().also {
|
val copy = instructions.copyOf().also {
|
||||||
val modifiedOperation = if (it[index].operation == Operation.Nop) Operation.Jmp else Operation.Nop
|
val modifiedOperation = if (it[index].operation == Operation.Nop) Operation.Jmp else Operation.Nop
|
||||||
it[index] = it[index].copy(operation = modifiedOperation)
|
it[index] = it[index].copy(operation = modifiedOperation)
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user