An example source code on scala.Option in Scala 3 API documents

An example source code on scala.Option in Scala 3 API documents,

val abc = new java.util.HashMap[Int, String]
abc.put(1, “A”)
bMaybe = Option(abc.get(2))
bMaybe match {
case Some(b) =>
println(s"Found $b")
case None =>
println(“Not found”)
}

bMaybe = Option(abc.get(2))

should be

val bMaybe = Option(abc.get(2)) .

Am I right?

It looks like the documentation page was built buggy overall, or loaded incorrectly / incompletely. (There has been some weird internet outages going on recently.)

2 Likes

Yes, you are correct, the val keyword is missing there.
If you want, you may open a PR fixing that typo :slight_smile:

The ticket for Option doc is

I’m always consulting the Javadoc for String and Class, and maybe Formatter and Pattern, but I only look at the Scaladoc for List and Option, so I think it ought to be pristine.

2 Likes