What is the main difference between the optional Scala option of Java 8 and Haskell’s may?

I've read several articles about the upcoming optional types in Java 8, and I want to know why people keep suggesting that it's not as powerful as the scala option As far as I know, it has:

>Use higher-order functions of Java 8 Lambdas, such as maps and filters. > Monadic flatmap is short circuited through getorelse type function

I'm missing what

Solution

There are some possibilities (Otoh, I don't see people really say that, so they may mean something else)

>No pattern matching. > Not equivalent to scala's folding or Haskell's frommay: you must perform optional map(…). Or ElseGet(…). > There is no unary grammar

I won't call anything "less powerful" because you can express everything with the corresponding Scala / Haskell type; These are simplicity / usability issues

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>