@@ -579,6 +579,11 @@ fun <T> Iterable<T>.toImmutableList(): ImmutableList<T> =
579579 this as ? ImmutableList
580580 ? : this .toPersistentList()
581581
582+ /* *
583+ * Returns an immutable list containing all elements of this array.
584+ */
585+ fun <T > Array <out T >.toImmutableList (): ImmutableList <T > = toPersistentList()
586+
582587/* *
583588 * Returns an immutable list containing all elements of this sequence.
584589 */
@@ -590,9 +595,6 @@ fun <T> Sequence<T>.toImmutableList(): ImmutableList<T> = toPersistentList()
590595fun CharSequence.toImmutableList (): ImmutableList <Char > = toPersistentList()
591596
592597
593- // fun <T> Array<T>.toImmutableList(): ImmutableList<T> = immutableListOf<T>() + this.asList()
594-
595-
596598/* *
597599 * Returns a persistent list containing all elements of this collection.
598600 *
@@ -604,6 +606,11 @@ fun <T> Iterable<T>.toPersistentList(): PersistentList<T> =
604606 ? : (this as ? PersistentList .Builder )?.build()
605607 ? : persistentListOf<T >() + this
606608
609+ /* *
610+ * Returns a persistent list containing all elements of this array.
611+ */
612+ fun <T > Array <out T >.toPersistentList (): PersistentList <T > = persistentListOf<T >() + this
613+
607614/* *
608615 * Returns a persistent list containing all elements of this sequence.
609616 */
@@ -628,6 +635,13 @@ fun <T> Iterable<T>.toImmutableSet(): ImmutableSet<T> =
628635 ? : (this as ? PersistentSet .Builder )?.build()
629636 ? : persistentSetOf<T >() + this
630637
638+ /* *
639+ * Returns an immutable set of all elements of this array.
640+ *
641+ * Elements of the returned set are iterated in the same order as in this array.
642+ */
643+ fun <T > Array <out T >.toImmutableSet (): ImmutableSet <T > = toPersistentSet()
644+
631645/* *
632646 * Returns an immutable set of all elements of this sequence.
633647 *
@@ -656,6 +670,13 @@ fun <T> Iterable<T>.toPersistentSet(): PersistentSet<T> =
656670 ? : (this as ? PersistentOrderedSetBuilder )?.build()
657671 ? : PersistentOrderedSet .emptyOf<T >() + this
658672
673+ /* *
674+ * Returns a persistent set of all elements of this array.
675+ *
676+ * Elements of the returned set are iterated in the same order as in this array.
677+ */
678+ fun <T > Array <out T >.toPersistentSet (): PersistentSet <T > = persistentSetOf<T >() + this
679+
659680/* *
660681 * Returns a persistent set of all elements of this sequence.
661682 *
@@ -685,6 +706,13 @@ fun <T> Iterable<T>.toPersistentHashSet(): PersistentSet<T>
685706 ? : (this as ? PersistentHashSetBuilder <T >)?.build()
686707 ? : PersistentHashSet .emptyOf<T >() + this
687708
709+ /* *
710+ * Returns a persistent set of all elements of this array.
711+ *
712+ * Order of the elements in the returned set is unspecified.
713+ */
714+ fun <T > Array <out T >.toPersistentHashSet (): PersistentSet <T > = persistentHashSetOf<T >() + this
715+
688716/* *
689717 * Returns a persistent set of all elements of this sequence.
690718 *
0 commit comments