refactor(aoc): simplify type defentitions
This commit is contained in:
parent
1ce78ef881
commit
891a0ecf91
2 changed files with 4 additions and 4 deletions
|
@ -31,7 +31,7 @@ class Solution04 {
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun parseCards(lines: List<String>): MutableList<Card> {
|
private fun parseCards(lines: List<String>): MutableList<Card> {
|
||||||
val cards: MutableList<Card> = mutableListOf()
|
val cards = mutableListOf<Card>()
|
||||||
|
|
||||||
for (line in lines) {
|
for (line in lines) {
|
||||||
val (_, numbers) = line.split(": ")
|
val (_, numbers) = line.split(": ")
|
||||||
|
|
|
@ -2,8 +2,8 @@ import kotlin.math.min
|
||||||
import kotlin.math.max
|
import kotlin.math.max
|
||||||
|
|
||||||
class Solution05(lines: List<String>) {
|
class Solution05(lines: List<String>) {
|
||||||
private var seeds: MutableList<Long> = mutableListOf()
|
private var seeds = mutableListOf<Long>()
|
||||||
private var maps: MutableList<MapList> = mutableListOf()
|
private var maps = mutableListOf<MapList>()
|
||||||
|
|
||||||
init {
|
init {
|
||||||
// Parse seeds
|
// Parse seeds
|
||||||
|
@ -107,7 +107,7 @@ class Solution05(lines: List<String>) {
|
||||||
|
|
||||||
// Map stores the rules for matching one number to another.
|
// Map stores the rules for matching one number to another.
|
||||||
class MapList() {
|
class MapList() {
|
||||||
val mappers: MutableList<Mapper> = mutableListOf()
|
val mappers = mutableListOf<Mapper>()
|
||||||
|
|
||||||
fun addRange(sourceRangeStart: Long, destRangeStart: Long, rangeLength: Long) {
|
fun addRange(sourceRangeStart: Long, destRangeStart: Long, rangeLength: Long) {
|
||||||
mappers.add(
|
mappers.add(
|
||||||
|
|
Loading…
Reference in a new issue