In my scala code:
QueueManager.add(getObject)
where getObject is a method that returns an object of type QueueObject
getObject
QueueObject
If it instead returned Option[QueueObject] you could use a construct like getObject.foreach { QueueManager.add }. You can wrap it right inline with Option(getObject).foreach ... because Option[QueueObject](null) is None.
Option[QueueObject]
getObject.foreach { QueueManager.add }
Option(getObject).foreach ...
Option[QueueObject](null)
None