To learn about the list and Listbuffer in Scala today.
Many operations within the Scala list are listbuffer, because changing the elements listbuffer very efficient,
TL is var type, but he belongs to the Scala package and the child package, we seem to be mutable, but because of the limitations of the package we do not see.
List append element, if TL front without private[scala], you can change in addition to the first element, all other elements built by the list,
Because we have the same TL, append different elements, construct different lists, you can share the case class::,
The list of operation Tails, pointing to the same data structure.
If it is developed completely externally, because the TL element is not controllable, it is troublesome to share.
Listbuffer has start,last0, the element content as start, appended from the back,
We should not only ensure the efficiency of the elements, but also the external is the function of the style, so with Private[scala] Var
Listbuffer is the content of the Scala sub-package, so you can access and modify the list, while the external is private, other objects
It is not possible to modify the list so that it can be both variable and functional in style.
Share more of the Scala resources:
Baidu Cloud Disk: http://pan.baidu.com/s/1gd7133t
Micro Cloud Disk: http://share.weiyun.com/047efd6cc76d6c0cb21605cfaa88c416
360 Cloud Disk: Http://yunpan.cn/cQN9gvcKXe26M (extract code: 13CD)
Information from DT Big Data Dream Factory public account: Dt_spark
Follow the account for more information about Scala learning
84th: Scala's list and listbuffer design implementation thinking