The plusand minus extension functions for PersistentCollection, PersistentListand PersistentSetsupport Array as argument but there are no extension functions to convert an array to persistent collections.
Example for converting an Array to a PersistentList:
fun <T> Array<out T>.toPersistentList(): PersistentList<T> = persistentListOf<T>() + this
The
plus
andminus
extension functions forPersistentCollection
,PersistentList
andPersistentSet
supportArray
as argument but there are no extension functions to convert an array to persistent collections.Example for converting an
Array
to aPersistentList
:fun <T> Array<out T>.toPersistentList(): PersistentList<T> = persistentListOf<T>() + this