Skip to content

Commit 6a4b911

Browse files
Abduqodiri Qurbonzodaqurbonzoda
authored andcommitted
Add CharSequence.toPersistentHashSet as an alternative to CharSequence.toPersistentSet
1 parent b4de092 commit 6a4b911

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

core/commonMain/src/extensions.kt

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -589,6 +589,14 @@ fun CharSequence.toPersistentList(): PersistentList<Char> =
589589
fun CharSequence.toPersistentSet(): PersistentSet<Char> =
590590
persistentSetOf<Char>().mutate { this.toCollection(it) }
591591

592+
/**
593+
* Returns a persistent set of all characters.
594+
*
595+
* Order of the elements in the returned set is unspecified.
596+
*/
597+
fun CharSequence.toPersistentHashSet(): PersistentSet<Char> =
598+
persistentHashSetOf<Char>().mutate { this.toCollection(it) }
599+
592600

593601
/**
594602
* Returns an immutable set of all elements of this collection.

0 commit comments

Comments
 (0)