-
-
Notifications
You must be signed in to change notification settings - Fork 105
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Linked List: how to handle the empty list in pop and shift? #286
Comments
I agree that testing the empty case would be a good idea. Returning an option value is also more idiomatic, so it would be great if you could also change that to |
Cool, thanks! I'll send those changes later today. |
Sorry I read the PR before seeing there was a related issue that I should have commented on... Copying my comment here: I agree this is more idiomatic, but from the description.md it says:
|
Sorry, I haven't read the README carefully enough. I agree with @robkeim, I think my pull request should be reverted. |
Whoops. Totally missed that. A retraction is then indeed better |
#300) * Fix #286 - Linked List: change pop and shift to return option * Linked List: Add missing Ignore attribute * Markdown: Use correct tags for italic and bold text * Revert "Fix #286 - Linked List: change pop and shift to return option" This reverts commit 9da0115. * atbash-cipher: Replace [<TestCase>] tests with individual tests (#298) * Add missing [<Test>] attribute * Add missing [<Ignore>] attributes
* Fix #286 - Linked List: change pop and shift to return option * Linked List: Add missing Ignore attribute * Markdown: Use correct tags for italic and bold text * Revert "Fix #286 - Linked List: change pop and shift to return option" This reverts commit 9da0115. * Acronym: Replace [<TestCase>] tests with individual tests (#298) * acronym: Add missing [<TestCase>] attribute * Add missing [<Ignore>] attributes
* Fix #286 - Linked List: change pop and shift to return option * Linked List: Add missing Ignore attribute * Markdown: Use correct tags for italic and bold text * Revert "Fix #286 - Linked List: change pop and shift to return option" This reverts commit 9da0115. * clock: Replace [<TestCase>] tests with individual tests (#298)
There is currently no unit test checking what
pop
andshift
do when the list is empty. I wonder if returning anoption
would be a better way to handle this case instead of returning the value if present or throwing an exception. ThoughMap
has separatefind
andtryFind
methods so I'm not sure if this is idiomatic.I think adding tests for the empty case would be a good idea in any case and if you agree, I can write them. And if you think
option
is the way to go, I will change that too.The text was updated successfully, but these errors were encountered: