scala-hamsters / hamsters

A mini Scala utility library
Apache License 2.0
291 stars 23 forks source link

Implement orEmpty for Option[T] #35

Closed dgouyette closed 7 years ago

dgouyette commented 7 years ago
val stringOpt: Option[String] = None
stringOpt.orEmpty // ""

val intOpt: Option[Int] = None
intOpt.orEmpty // 0

val listOpt: Option[List[Int]] = None
listOpt.orEmpty // List()
sohum2002 commented 7 years ago

I'm going to create a pull request for this :)

sohum2002 commented 7 years ago

@dgouyette Please check my PR : https://github.com/scala-hamsters/hamsters/pull/44