Skip to content

docs: clarify insertion order and correct collection examples - #65

Open
x0Lazarus wants to merge 2 commits into
elliotchance:masterfrom
x0Lazarus:docs/clarify-insertion-order
Open

x0Lazarus wants to merge 2 commits into
elliotchance:masterfrom
x0Lazarus:docs/clarify-insertion-order

Conversation

@x0Lazarus

@x0Lazarus x0Lazarus commented Sep 18, 2026

Copy link
Copy Markdown

Clarify in Basic Usage that OrderedMap preserves insertion order and does not sort keys. The iteration examples now use that same map to show foo before 123.

Also fix the missing closing parentheses in both Collect examples and update their output to match the basic example, including the native map's printed format.

Validation: compiled and ran the three iteration/collection snippets with the basic example's setup; their output matches the README. Both collection snippets failed to compile before this change. go test -count=1 -v ./... and go vet ./... pass in v3 with Go 1.27.1 on Windows.

Clarified that the range loops stop after their iterator finishes yielding, while Front/Next and Back/Prev traverse element pointers until nil. The manual README examples compile and print the expected forward/reverse order; empty, single-element and multi-element termination checks also pass.

Closes #58.


This change is Reviewable

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.

doc suggestion: note up front it is not sorted by key, but insertion order.

1 participant