Just a little improvement, no code change
This commit is contained in:
@@ -4,18 +4,18 @@ package org.duckdns.davygora.matrix.util
|
||||
inline fun <reified T> Any.toListChecked(): List<T> =
|
||||
when (this) {
|
||||
is List<*> -> this
|
||||
is Collection<*> -> this.toList()
|
||||
is Iterable<*> -> this.toList()
|
||||
is Sequence<*> -> this.toList()
|
||||
is Array<*> -> this.asList()
|
||||
is BooleanArray -> this.asList()
|
||||
is ByteArray -> this.asList()
|
||||
is CharArray -> this.asList()
|
||||
is DoubleArray -> this.asList()
|
||||
is FloatArray -> this.asList()
|
||||
is IntArray -> this.asList()
|
||||
is LongArray -> this.asList()
|
||||
is ShortArray -> this.asList()
|
||||
is Collection<*> -> toList()
|
||||
is Iterable<*> -> toList()
|
||||
is Sequence<*> -> toList()
|
||||
is Array<*> -> asList()
|
||||
is BooleanArray -> asList()
|
||||
is ByteArray -> asList()
|
||||
is CharArray -> asList()
|
||||
is DoubleArray -> asList()
|
||||
is FloatArray -> asList()
|
||||
is IntArray -> asList()
|
||||
is LongArray -> asList()
|
||||
is ShortArray -> asList()
|
||||
else -> error("Unsupported type: ${this::class}")
|
||||
}.also { list ->
|
||||
require(list.all { it is T })
|
||||
|
||||
Reference in New Issue
Block a user