#scala
Read more stories on Hashnode
Articles with this tag
Introduction I have decided to dump my personal leetcode solutions archive. Currently it contains Scala solutions only. I will eventually publish all...
Let's implement a simple case class that represents a Time object that contains hours and minutes. For simplicity, we will use 24-hour clock. case...
Scala Array is not located in the scala.collection.mutable package, however, they are in fact mutable val arr = Array(1,2,3) arr(1) =...
There is an amazing util in Scala that is available in scala.util.chaining._. It adds two implicit methods to any scala object that allow chain...
We often use Option to handle collections safely: val collection = Map.empty[Int, Int] // unsafe way that will throw an exception if key is not...
Case classes in Scala are very handy because they have build extractor capability and other free features. We can define a case class and then use it...