toString

abstract override fun toString(): String

Returns the string representation of this collection.

Implementations of this method should behave like calling the Iterable.toString method.


Calling from Kotlin

Here's an example of calling this method from Kotlin code:

val collection: NotEmptyCollection<Int> = notEmptyListOf(1, 2, 3)
val actual = "$collection"
val expected = "${listOf(1, 2, 3)}"
assertEquals(expected, actual)