toList

fun toList(): List<E>

Returns all elements of this list as a List of type E.


Calling from Kotlin

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

val notEmptyList: NotEmptyList<Int> = notEmptyListOf(1, 2, 3)
val actual: List<Int> = notEmptyList.toList()
val expected: List<Int> = listOf(1, 2, 3)
assertContentEquals(expected, actual)