1
0
mirror of https://github.com/chylex/Hardcore-Ender-Expansion-2.git synced 2025-04-11 03:15:44 +02:00

Add Iterator.any & Iterator.find extensions

This commit is contained in:
chylex 2019-10-12 14:07:27 +02:00
parent 2eeb1f13ae
commit a2f14d8c39

View File

@ -0,0 +1,21 @@
package chylex.hee.system.util
inline fun <T> Iterator<T>.any(predicate: (T) -> Boolean): Boolean{
for(element in this){
if (predicate(element)){
return true
}
}
return false
}
inline fun <T> Iterator<T>.find(predicate: (T) -> Boolean): T?{
for(element in this){
if (predicate(element)){
return element
}
}
return null
}