The standard template used in the Scala class library is to define classes within classes and attributes. And most operations of objects of parent classes lead to the creation of objects of created inner classes. Each inner class is different for each object.
eg. See Source for scala.io.Source and LineIterator. I think this is the easiest in the standard library.
Two different classes are presented as the documents below.
val s1:Source = ...
val s2:Source = ...
s1.getLines.getClass != s2.getLines.getClass //true if s1 != s2
The meaning of creating two classes.
Since the entire collection library uses the same template, what are the effects on the permenton space for lengthy processes?
source
share