toString

abstract override fun toString(): String

Returns the string representation of this collection.

Implementations of this function should behave like calling the Any.toString function on an Iterable.


Calling from Kotlin

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

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