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
isEqual should be added to Option as convenience method #6064
Comments
Imported From: https://issues.scala-lang.org/browse/SI-6064?orig=1 |
@SethTisue said:
|
Otto (otto5) said: |
@soc said: Is there and reason for Option missing contains, considering that its API is pretty much identical to the collections API? I guess this is an oversight and should be fixed. |
Otto (otto5) said: |
@soc said: |
@adriaanm said: |
@soc said: thanks for your bug report! It made us aware that the Sadly, the deadline for adding it to Scala 2.10 was missed by a week, but as you see, the method was already added and will appear in 2.11. |
isEqual should be added to Option as a convenience method in order to compare a value with the value contained in an Option
def isEqual(other: Any): Boolean
so that you can write
Some(123) isEqual 123 = true
You can't use equals, because the other value is no option. This is a pure convenience method, one can do something like:
-Some(123).getOrElse(false) equals 123
-Some(123).exists(_ equals 123)
this should be a very easy addition.
The text was updated successfully, but these errors were encountered: