Implemented *Array.toString() for all arrays
This commit is contained in:
@@ -47,6 +47,10 @@ public final class Array<T> {
|
|||||||
return IteratorImpl(this)
|
return IteratorImpl(this)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public override fun toString(): String {
|
||||||
|
return this.joinToString(separator = ", ", prefix = "[", postfix = "]")
|
||||||
|
}
|
||||||
|
|
||||||
// Konan-specific.
|
// Konan-specific.
|
||||||
@SymbolName("Kotlin_Array_getArrayLength")
|
@SymbolName("Kotlin_Array_getArrayLength")
|
||||||
external private fun getArrayLength(): Int
|
external private fun getArrayLength(): Int
|
||||||
|
|||||||
@@ -64,6 +64,10 @@ public final class ByteArray {
|
|||||||
public operator fun iterator(): ByteIterator {
|
public operator fun iterator(): ByteIterator {
|
||||||
return ByteIteratorImpl(this)
|
return ByteIteratorImpl(this)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public override fun toString(): String {
|
||||||
|
return this.joinToString(separator = ", ", prefix = "[", postfix = "]")
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: replace with generics, once implemented.
|
// TODO: replace with generics, once implemented.
|
||||||
@@ -116,6 +120,10 @@ public final class CharArray {
|
|||||||
public operator fun iterator(): kotlin.collections.CharIterator {
|
public operator fun iterator(): kotlin.collections.CharIterator {
|
||||||
return CharIteratorImpl(this)
|
return CharIteratorImpl(this)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public override fun toString(): String {
|
||||||
|
return this.joinToString(separator = ", ", prefix = "[", postfix = "]")
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private class CharIteratorImpl(val collection: CharArray) : CharIterator() {
|
private class CharIteratorImpl(val collection: CharArray) : CharIterator() {
|
||||||
@@ -167,6 +175,10 @@ public final class ShortArray {
|
|||||||
public operator fun iterator(): kotlin.collections.ShortIterator {
|
public operator fun iterator(): kotlin.collections.ShortIterator {
|
||||||
return ShortIteratorImpl(this)
|
return ShortIteratorImpl(this)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public override fun toString(): String {
|
||||||
|
return this.joinToString(separator = ", ", prefix = "[", postfix = "]")
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private class ShortIteratorImpl(val collection: ShortArray) : ShortIterator() {
|
private class ShortIteratorImpl(val collection: ShortArray) : ShortIterator() {
|
||||||
@@ -218,6 +230,10 @@ public final class IntArray {
|
|||||||
public operator fun iterator(): kotlin.collections.IntIterator {
|
public operator fun iterator(): kotlin.collections.IntIterator {
|
||||||
return IntIteratorImpl(this)
|
return IntIteratorImpl(this)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public override fun toString(): String {
|
||||||
|
return this.joinToString(separator = ", ", prefix = "[", postfix = "]")
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private class IntIteratorImpl(val collection: IntArray) : IntIterator() {
|
private class IntIteratorImpl(val collection: IntArray) : IntIterator() {
|
||||||
@@ -269,6 +285,10 @@ public final class LongArray {
|
|||||||
public operator fun iterator(): kotlin.collections.LongIterator {
|
public operator fun iterator(): kotlin.collections.LongIterator {
|
||||||
return LongIteratorImpl(this)
|
return LongIteratorImpl(this)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public override fun toString(): String {
|
||||||
|
return this.joinToString(separator = ", ", prefix = "[", postfix = "]")
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private class LongIteratorImpl(val collection: LongArray) : LongIterator() {
|
private class LongIteratorImpl(val collection: LongArray) : LongIterator() {
|
||||||
@@ -320,6 +340,10 @@ public final class FloatArray {
|
|||||||
public operator fun iterator(): kotlin.collections.FloatIterator {
|
public operator fun iterator(): kotlin.collections.FloatIterator {
|
||||||
return FloatIteratorImpl(this)
|
return FloatIteratorImpl(this)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public override fun toString(): String {
|
||||||
|
return this.joinToString(separator = ", ", prefix = "[", postfix = "]")
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private class FloatIteratorImpl(val collection: FloatArray) : FloatIterator() {
|
private class FloatIteratorImpl(val collection: FloatArray) : FloatIterator() {
|
||||||
@@ -367,6 +391,10 @@ public final class DoubleArray {
|
|||||||
public operator fun iterator(): kotlin.collections.DoubleIterator {
|
public operator fun iterator(): kotlin.collections.DoubleIterator {
|
||||||
return DoubleIteratorImpl(this)
|
return DoubleIteratorImpl(this)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public override fun toString(): String {
|
||||||
|
return this.joinToString(separator = ", ", prefix = "[", postfix = "]")
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private class DoubleIteratorImpl(val collection: DoubleArray) : DoubleIterator() {
|
private class DoubleIteratorImpl(val collection: DoubleArray) : DoubleIterator() {
|
||||||
@@ -414,6 +442,10 @@ public final class BooleanArray {
|
|||||||
public operator fun iterator(): kotlin.collections.BooleanIterator {
|
public operator fun iterator(): kotlin.collections.BooleanIterator {
|
||||||
return BooleanIteratorImpl(this)
|
return BooleanIteratorImpl(this)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public override fun toString(): String {
|
||||||
|
return this.joinToString(separator = ", ", prefix = "[", postfix = "]")
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private class BooleanIteratorImpl(val collection: BooleanArray) : BooleanIterator() {
|
private class BooleanIteratorImpl(val collection: BooleanArray) : BooleanIterator() {
|
||||||
|
|||||||
Reference in New Issue
Block a user