None
in pattern-matching SC-W1025Analyzer has detected that the case Some(_)
was specified in the pattern-matching but not None
. The general consensus is that any method that wraps a value in Some
usually has a return type of Option[T]
. In case the method succeeds, Some(_)
is returned, else None
. Therefore it is recommended that you add the missing case None
in your pattern-matching.
hashmap.get(key) match {
case Some(value) => println(s"value of $key is $value")
}
hashmap.get(key) match {
case Some(value) => println(s"value of $key is $value")
case None => println(s"$key is not in the hashmap!")
}