Implement asList, slice & sliceArray extension functions for UArrays

This commit is contained in:
Abduqodiri Qurbonzoda
2019-01-24 16:55:57 +03:00
committed by Ilya Gorbunov
parent 114736c09b
commit fc85781bfc
16 changed files with 646 additions and 39 deletions
@@ -46,8 +46,7 @@ internal constructor(@PublishedApi internal val storage: ShortArray) : Collectio
}
override fun containsAll(elements: Collection<UShort>): Boolean {
if ((elements as Collection<Any?>).any { it as? UShort == null }) return false
return elements.all { storage.contains(it.toShort()) }
return (elements as Collection<*>).all { it is UShort && storage.contains(it.toShort()) }
}
override fun isEmpty(): Boolean = this.storage.size == 0