Why is the class sold in Scala?

Asked 2 years ago, Updated 2 years ago, 122 views

Why isn't scala.collection.mutable.TreeMap sold and other Map (for example, HashMap)?(Furthermore, the immutable TreeMap was final, and HashMap was sold, so no modifier criteria could be found.)

I thought the reason why I use the sealed class in Scala is to combine it with the case class so that the compiler can detect pattern match leaks, but is there any other reason?

scala

2022-09-30 21:25

1 Answers

I want to prevent inheritance and expansion, but I think finalizing it is not an implementation that can return a class inherited from TreeMap such as rangeImpl.


2022-09-30 21:25

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.