apply
methods make the new
keyword redundant SC-R1069In Scala 2, the new
keyword was required to instantiate a class
. However, case
classes were an exception as an appropriate apply()
is automatically generated for them, thus making the new
keyword redundant. In Scala 3, this concept has been generalized to all concrete classes. Therefore, you can safely drop the new
keyword.
val sb = new StringBuilder()
val sb = StringBuilder()