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