1

I'm trying to create a new Java object based off a Scala case class. All seemed to be fine, including creating new objects within the first initialisation, until I needed to fill in attributes of type Option[X] (where X is some other type. It varies based on the parameter).

In cases where this attribute had a value I managed to get by using Some.apply("value") however I'm at a bit of a loss of what to use when no value exists. If this were a Scala object creation I would use None, however that doesn't seem to be an option with Java.

I've tried using Option.apply(null), scala.None and null without success. How does one give a None value with a type matching scala.Option<A> in Java?

Ben Reich
  • 16,222
  • 2
  • 38
  • 59
GroomedGorilla
  • 920
  • 2
  • 10
  • 30

0 Answers0