Skip to content

Add ordered set#2

Open
wagoodman wants to merge 1 commit intomainfrom
add-ordered-set
Open

Add ordered set#2
wagoodman wants to merge 1 commit intomainfrom
add-ordered-set

Conversation

@wagoodman
Copy link

Add a collection which is a set (removes duplicates) however, the insertion order is preserved when obtaining a slice / iterating.

Signed-off-by: Alex Goodman <wagoodman@users.noreply.github.com>
Copy link
Contributor

@kzantow kzantow left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

}

// ToSlice returns a slice of all elements in insertion order
func (s *OrderedSet[T]) ToSlice() []T {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe instead of or in addition ToSlice, add an iterator function?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants