linkedliststack not longer requires T to be comparable #288
No reviewers
Labels
No labels
bug
discussion
documentation
duplicate
ignore
new feature
question
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
golibs/gms-gods!288
Loading…
Reference in a new issue
No description provided.
Delete branch "oliverdain/simple-list"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
I had a use case for a stack with a type that's not comparable. I noticed that none of the methods on
linkedliststack.Stackactually requiresTto be comparable. It seems the requirement stems from the fact thatlinkedliststackis based onsinglylinkedlistwhich has 3 methods (IndexOf,Contains, andSort) whichStackdoesn't use.This refactors
singlylinkedlist.Listinto asinglylinkedlist.SimpleListwhich has aT anygeneric type. And thensinglylinkedlist.ListembedsSimpleListand adds those 3 methods. ThenStackis based on aSimpleList[T any]and it no longer requires comparable.If you like the general approach here I suspect you'd want additional changes like an interface for simple lists, maybe all stacks no longer require comparable, etc. I wanted to get some early feedback to see if you're on board with this direction and, if so, where you'd want to take this.
Issues
0 New issues
0 Accepted issues
Measures
0 Security Hotspots
0.0% Coverage on New Code
0.0% Duplication on New Code
See analysis details on SonarQube Cloud
View command line instructions
Manual merge helper
Use this merge commit message when completing the merge manually.
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.