What does a "?" symbol (question mark) mean in Scala?

scala, syntax

Solution

For me it looks like the apply method of Option. Is there somewhere the following import statement in the code:

import Option.{apply => ?}

This means apply is imported as ?. From the doc of Option.apply:

An Option factory which creates Some(x) if the argument is not null, and None if it is null.

The whole statement means then:

if conf.get("scoobi.jobid") is not equal null, assign this string, otherwise assign the string sys.error("Scoobi job id not set.") returns

Problem

I meet some scala code with "?" but do not know what it mean in scala, could anyone explain it to me ? Thanks. And here's one example ``` def getJobId(conf: Configuration): String = ?(conf.get("scoobi.jobid")).getOrElse(sys.error("Scoobi job id not set.")) ```

Original source

Related problems