Skip to content

Can’t call OrderedSet.empty #117

Answered by vitoke
mxcl asked this question in Q&A
Oct 30, 2022 · 1 comments · 2 replies
Discussion options

You must be logged in to vote

The ordered collections take an existing collection and add the order administration to them. Therefore, the OrderedSet can be seen as an interface that can be used for all ordered sets.

To instantiate ordered sets, there are the following options:

  • use the OrderedHashSet to have an ordered collection that internally uses a HashSet. So this would become OrderedHashSet.empty<string>()
  • use the OrderedSortedSet to have an ordered collection that internally uses a SortedSet. So this would become OrderedSortedSet.empty<string>()
  • Create a custom context with a configured collection: OrderedSet.createContext(...options...).empty<string>()

If you don't need your collection to be sorted, the Orde…

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@mxcl
Comment options

@vitoke
Comment options

Answer selected by mxcl
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants