I was wondering what do you guys think is more idiomatic and better in terms of performance.
Over a monad of type Option or Try, use pattern matching or map and getOrElse in case you want to control the side effect.
So what do you think is better this:
maybeConnectTimeout
.map(connectTimeout => session.connect(connectTimeout))
.getOrElse(session.connect())
Or this
maybeConnectTimeout match {
case Some(connectTimeout) => session.connect(connectTimeout)
case None => session.connect()
}