Why is the class sold in Scala?

Asked 1 years ago, Updated 1 years ago, 102 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.