scala-option
Scala: filtering a collection of Options
Say I have a function that checks whether some operation is applicable to an instance of A and, if so, returns an instance of B or None:[详细]
2023-04-07 23:45 分类:问答Producing a partially applied function from method of type in an Option
Suppose I\'m writing a GUI class Kitteh (val age: Int) { require (age < 5) def saveMeow(file: File) = { /* implementation */ }[详细]
2023-04-03 10:40 分类:问答Some constructor with asInstanceOf
When I was writing my recent answer I also tried to solve the problem in more \"functional\" way, but stuck with the following problem:[详细]
2023-03-25 18:15 分类:问答Better to return None or throw an exception when fetching URL?
I have a Scala helper method that currently tries to fetch a URL and return an Option[String] with the HTML of that webpage.[详细]
2023-03-23 22:48 分类:问答Examples of using some Scala Option methods
I have read the blog post recommended me here. Now I wonder what some those methods are useful for. Can you show e开发者_开发知识库xamples of using forall (as opposed to foreach) and toList of Option?[详细]
2023-03-23 14:37 分类:问答Which Scala methods return null instead of an Option and why?
I wonder if the standard library is completely null-free and - if not 开发者_高级运维- would be interested what reasonable use-cases exist where returning null is preferable to returning some Option i[详细]
2023-03-09 20:23 分类:问答Why doesn't Option have a fold method?
I wonder wh开发者_StackOverflow社区y scala.Option doesn\'t have a method fold like this defined:[详细]
2023-02-17 09:37 分类:问答Why does the Option's orNull method have this superfluous implicit argument?
I wonder what is the reason for the (implicit ev: Null <:< A1) here: sealed abstract class Option[+A] extends Product with Serializable {[详细]
2023-02-17 04:10 分类:问答How to call scala's Option constructors from Java
I am working on a mixed java/scala pr开发者_开发知识库oject, and I am trying to call a scala object\'s method from Java.This method takes an Option[Double] as a parameter.I thought this would work:[详细]
2023-02-16 17:16 分类:问答Scala Option's collect method doesn't like my PartialFunction
I think I\'m missing something: scala> S开发者_StackOverflow中文版ome(1) collect ({ case n if n > 0 => n + 1; case _ => 0})[详细]
2023-02-14 11:46 分类:问答