scala - animeshtrivedi/notes GitHub Wiki

Whenever you can, always prefer LENGTH over size() which is a function over Sequence.

How to increase the JVM heap size for a scala experiment

 ./bin/scala  -J-Xmx128g

What is the difference between Some and Option

https://stackoverflow.com/questions/22908662/difference-between-optionvalue-and-somevalue

Option(x) is basically just saying if (x != null) Some(x) else None

In terms of defining the type used, always use Option[XYZ]. Some(x) and None are just used for the pattern matching to extract the value.

What is Scala lifting of partial functions

scala> val pf: PartialFunction[Int, Boolean] = { case i if i > 0 => i % 2 == 0}
pf: PartialFunction[Int,Boolean] = <function1>

scala> pf.lift
res1: Int => Option[Boolean] = <function1>

scala> res1(-1)
res2: Option[Boolean] = None

scala> res1(1)
res3: Option[Boolean] = Some(false)

https://stackoverflow.com/questions/17965059/what-is-lifting-in-scala

⚠️ **GitHub.com Fallback** ⚠️