Skip to content

Added doctests for map and collectFirst for NonEmptyList#4844

Open
loladenney wants to merge 6 commits intotypelevel:mainfrom
loladenney:main
Open

Added doctests for map and collectFirst for NonEmptyList#4844
loladenney wants to merge 6 commits intotypelevel:mainfrom
loladenney:main

Conversation

@loladenney
Copy link
Contributor

No description provided.

* scala> val nel = NonEmptyList.of(2, 4, 6, 8, 10)
* scala> nel.collectFirst { case v if v > 5 => v }
* res0: Option[Int] = Some(6)
* scala> nel.collectFirst { case v if v % 2 == 1 => "even" }
Copy link
Member

Choose a reason for hiding this comment

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

Should this say "odd"?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good catch! I'll fix that right now.

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