@@ -13,7 +13,9 @@ import kotlinx.collections.immutable.implementations.immutableMap.PersistentHash
1313import kotlinx.collections.immutable.implementations.immutableSet.PersistentHashSet
1414import kotlinx.collections.immutable.implementations.immutableSet.PersistentHashSetBuilder
1515import kotlinx.collections.immutable.implementations.persistentOrderedMap.PersistentOrderedMap
16+ import kotlinx.collections.immutable.implementations.persistentOrderedMap.PersistentOrderedMapBuilder
1617import kotlinx.collections.immutable.implementations.persistentOrderedSet.PersistentOrderedSet
18+ import kotlinx.collections.immutable.implementations.persistentOrderedSet.PersistentOrderedSetBuilder
1719
1820// @Suppress("INVISIBLE_MEMBER", "INVISIBLE_REFERENCE")
1921// inline fun <T> @kotlin.internal.Exact ImmutableCollection<T>.mutate(mutator: (MutableCollection<T>) -> Unit): ImmutableCollection<T> = builder().apply(mutator).build()
@@ -593,9 +595,9 @@ fun <T> Iterable<T>.toImmutableSet(): ImmutableSet<T> =
593595 * Elements of the returned set are iterated in the same order as in this collection
594596 */
595597fun <T > Iterable<T>.toPersistentSet (): PersistentSet <T > =
596- this as ? PersistentSet <T >
597- ? : (this as ? PersistentSet . Builder )?.build()
598- ? : persistentSetOf <T >() + this
598+ this as ? PersistentOrderedSet <T >
599+ ? : (this as ? PersistentOrderedSetBuilder )?.build()
600+ ? : PersistentOrderedSet .emptyOf <T >() + this
599601
600602/* *
601603 * Returns a persistent set containing all elements from this set.
@@ -621,7 +623,7 @@ fun <T> Set<T>.toPersistentHashSet(): PersistentSet<T>
621623fun <K , V > Map <K , V >.toImmutableMap (): ImmutableMap <K , V >
622624 = this as ? ImmutableMap
623625 ? : (this as ? PersistentMap .Builder )?.build()
624- ? : PersistentOrderedMap .emptyOf <K , V >().putAll(this )
626+ ? : persistentMapOf <K , V >().putAll(this )
625627
626628/* *
627629 * Returns a persistent map containing all entries from this map.
@@ -632,8 +634,8 @@ fun <K, V> Map<K, V>.toImmutableMap(): ImmutableMap<K, V>
632634 * Entries of the returned map are iterated in the same order as in this map.
633635 */
634636fun <K , V > Map <K , V >.toPersistentMap (): PersistentMap <K , V >
635- = this as ? PersistentMap <K , V >
636- ? : (this as ? PersistentMap . Builder <K , V >)?.build()
637+ = this as ? PersistentOrderedMap <K , V >
638+ ? : (this as ? PersistentOrderedMapBuilder <K , V >)?.build()
637639 ? : PersistentOrderedMap .emptyOf<K , V >().putAll(this )
638640
639641/* *
@@ -645,6 +647,6 @@ fun <K, V> Map<K, V>.toPersistentMap(): PersistentMap<K, V>
645647 * Order of the entries in the returned map is unspecified.
646648 */
647649fun <K , V > Map <K , V >.toPersistentHashMap (): PersistentMap <K , V >
648- = this as ? PersistentMap
650+ = this as ? PersistentHashMap
649651 ? : (this as ? PersistentHashMapBuilder <K , V >)?.build()
650652 ? : PersistentHashMap .emptyOf<K , V >().putAll(this )
0 commit comments