1
0

Safer/faster array copy

This commit is contained in:
Hubert Van De Walle 2020-12-08 08:02:08 +01:00
parent ee2dfbd40b
commit 1923e54548

View File

@ -48,7 +48,7 @@ class Day08(@Lines val input: Input<List<String>>) {
}
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
it[index] = it[index].copy(operation = modifiedOperation)
}