mirror of
https://gitlab.bixilon.de/bixilon/minosoft.git
synced 2025-09-14 01:48:04 -04:00
optimize emtpy section iteration
This commit is contained in:
parent
a5cead6768
commit
792c8e3b40
@ -226,6 +226,9 @@ open class SectionDataProvider<T>(
|
||||
|
||||
@Suppress("UNCHECKED_CAST")
|
||||
override fun iterator(): Iterator<T> {
|
||||
return (data?.iterator() ?: EmptyIterator) as Iterator<T>
|
||||
val data = this.data ?: return EmptyIterator.unsafeCast()
|
||||
if (this.isEmpty) return EmptyIterator.unsafeCast()
|
||||
|
||||
return data.iterator().unsafeCast()
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user