Is it possible to sort the collection? #57
Unanswered
BryanJBryce
asked this question in
Q&A
Replies: 1 comment 1 reply
-
You can use the in-place mutation version, For example, even if we defined a new sorted to return var xs = IdentifiedArray<String, String>(id: \.self)
type(of: xs.sorted()) // IdentifiedArray<String, String>
var ys = xs as any Sequence<String>
type(of: ys.sorted()) // Array<String> That behavior can be surprising, which I think is why we chose not to define |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I try to sort and it gets turned back into a normal array.
Beta Was this translation helpful? Give feedback.
All reactions