refactor(aoc): simplify type defentitions

This commit is contained in:
Ivan R. 2024-02-05 00:41:47 +05:00
parent 1ce78ef881
commit 891a0ecf91
No known key found for this signature in database
GPG key ID: 56C7BAAE859B302C
2 changed files with 4 additions and 4 deletions

View file

@ -31,7 +31,7 @@ class Solution04 {
}
private fun parseCards(lines: List<String>): MutableList<Card> {
val cards: MutableList<Card> = mutableListOf()
val cards = mutableListOf<Card>()
for (line in lines) {
val (_, numbers) = line.split(": ")

View file

@ -2,8 +2,8 @@ import kotlin.math.min
import kotlin.math.max
class Solution05(lines: List<String>) {
private var seeds: MutableList<Long> = mutableListOf()
private var maps: MutableList<MapList> = mutableListOf()
private var seeds = mutableListOf<Long>()
private var maps = mutableListOf<MapList>()
init {
// Parse seeds
@ -107,7 +107,7 @@ class Solution05(lines: List<String>) {
// Map stores the rules for matching one number to another.
class MapList() {
val mappers: MutableList<Mapper> = mutableListOf()
val mappers = mutableListOf<Mapper>()
fun addRange(sourceRangeStart: Long, destRangeStart: Long, rangeLength: Long) {
mappers.add(