say I have a function that takes in some kind of Option[]... namely:
def help(x: Int,
y : Option[BigInteger],
ec: ExecutionContext,
sc: SecurityContext): Future[Long] = { ... }
and I have an object that calls on it with map, say
val answerList: List[Future[Long]] = random.getPersons
.map(p => help(x , myY, ec, sc))
.collect(Collectors.toList())
where I have "myY" it says that
Type mismatch, expected Option[BigInteger], actual: BigInteger.
I see where this is coming as my help method made the type Option.
I tried casting myY by doing Option[myY] but that doesn't seem to help. Assuming help method is implemented correctly, can someone please help me out or point me to the right direction? Thank you!
I assume that myY
is a BigInteger, then all you need to do is call help with Option(myY)
instead of myY