Allow to construct lazy array on the fly

This commit is contained in:
DBotThePony 2022-10-08 15:46:43 +07:00
parent 058fe57a61
commit a538357573
Signed by: DBot
GPG Key ID: DCC23B5715498507

View File

@ -16,6 +16,10 @@ class LazyList<T> : AbstractList<T> {
this.getters = Array(getters.size) { getters[it] } this.getters = Array(getters.size) { getters[it] }
} }
constructor(size: Int, provider: (Int) -> () -> T) {
this.getters = Array(size, provider)
}
override val size: Int override val size: Int
get() = getters.size get() = getters.size