From a538357573ad044ac0fb1185102c2af9b6914b4a Mon Sep 17 00:00:00 2001 From: DBotThePony Date: Sat, 8 Oct 2022 15:46:43 +0700 Subject: [PATCH] Allow to construct lazy array on the fly --- src/main/kotlin/ru/dbotthepony/mc/otm/registry/LazyList.kt | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/registry/LazyList.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/registry/LazyList.kt index 12bc5416f..94c869bfd 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/registry/LazyList.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/registry/LazyList.kt @@ -16,6 +16,10 @@ class LazyList : AbstractList { this.getters = Array(getters.size) { getters[it] } } + constructor(size: Int, provider: (Int) -> () -> T) { + this.getters = Array(size, provider) + } + override val size: Int get() = getters.size