Use weak caches for custom textures
This commit is contained in:
9
src/main/kotlin/util/collections/listutil.kt
Normal file
9
src/main/kotlin/util/collections/listutil.kt
Normal file
@@ -0,0 +1,9 @@
|
||||
|
||||
package moe.nea.firmament.util.collections
|
||||
|
||||
fun <T, R> List<T>.lastNotNullOfOrNull(func: (T) -> R?): R? {
|
||||
for (i in indices.reversed()) {
|
||||
return func(this[i]) ?: continue
|
||||
}
|
||||
return null
|
||||
}
|
||||
Reference in New Issue
Block a user