It is more idiomatic in scala to use
None instead of
Some(null) instead of
None defeats the entire purpose of
Option. However, there might be certain scenarios where this is a legitimate approach, such as when dealing with Java-based libraries, to improve compatibility.
Carefully consider whether using
null is necessary before doing so.
Scala allows you to import entities from same package in separate statements. However, it is generally recommended that you group such imports together. Doing so makes the code more readable and easier to navigate.
finalmodifier is redundant for
A class cannot extend an object thereby making the
final modifier redundant. It is therefore recommended that you drop the said modifier.
Scala allows you to inherit from
scala.App (which uses
DelayedInit) to set up a simple and small
Main program. However, since
DelayedInit is now deprecated, it is recommended that you define a suitable entry point of your own.
Classes that are either
case or that implement the
unapply() method allow you to utilize pattern matching. However, in this case, all the patterns specified in the pattern matching are wildcard patterns. Either this is a mistake or you meant to simply match a specific type. In the latter's case, consider using the syntax