@@ -579,6 +579,11 @@ fun <T> Iterable<T>.toImmutableList(): ImmutableList<T> =
579
579
this as ? ImmutableList
580
580
? : this .toPersistentList()
581
581
582
+ /* *
583
+ * Returns an immutable list containing all elements of this array.
584
+ */
585
+ fun <T > Array <out T >.toImmutableList (): ImmutableList <T > = toPersistentList()
586
+
582
587
/* *
583
588
* Returns an immutable list containing all elements of this sequence.
584
589
*/
@@ -590,9 +595,6 @@ fun <T> Sequence<T>.toImmutableList(): ImmutableList<T> = toPersistentList()
590
595
fun CharSequence.toImmutableList (): ImmutableList <Char > = toPersistentList()
591
596
592
597
593
- // fun <T> Array<T>.toImmutableList(): ImmutableList<T> = immutableListOf<T>() + this.asList()
594
-
595
-
596
598
/* *
597
599
* Returns a persistent list containing all elements of this collection.
598
600
*
@@ -604,6 +606,11 @@ fun <T> Iterable<T>.toPersistentList(): PersistentList<T> =
604
606
? : (this as ? PersistentList .Builder )?.build()
605
607
? : persistentListOf<T >() + this
606
608
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
+
607
614
/* *
608
615
* Returns a persistent list containing all elements of this sequence.
609
616
*/
@@ -628,6 +635,13 @@ fun <T> Iterable<T>.toImmutableSet(): ImmutableSet<T> =
628
635
? : (this as ? PersistentSet .Builder )?.build()
629
636
? : persistentSetOf<T >() + this
630
637
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
+
631
645
/* *
632
646
* Returns an immutable set of all elements of this sequence.
633
647
*
@@ -656,6 +670,13 @@ fun <T> Iterable<T>.toPersistentSet(): PersistentSet<T> =
656
670
? : (this as ? PersistentOrderedSetBuilder )?.build()
657
671
? : PersistentOrderedSet .emptyOf<T >() + this
658
672
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
+
659
680
/* *
660
681
* Returns a persistent set of all elements of this sequence.
661
682
*
@@ -685,6 +706,13 @@ fun <T> Iterable<T>.toPersistentHashSet(): PersistentSet<T>
685
706
? : (this as ? PersistentHashSetBuilder <T >)?.build()
686
707
? : PersistentHashSet .emptyOf<T >() + this
687
708
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
+
688
716
/* *
689
717
* Returns a persistent set of all elements of this sequence.
690
718
*
0 commit comments