Scala in the 84th: Scala in the list and Listbuffer design to realize the thinking after learning sense

Source: Internet
Author: User

Final Case class:: [B] (private var hd:b, Private[scala] var tl:list[b]) extends List[b]

TL is limited access through private to ensure the immutability of TL, so that in the building of the head element HD different and then the list of the same new list can be directly pointed to the TL, efficient.

This ensures both functional programming and efficient creation of new objects.


interested friends please pay attention to DT Big Data Dream Factory public account: Dt_spark

Liaoliang Teacher Number: 18610086859

QQ Group:

DT Big Data Dream Factory ①:462923555

DT Big Data Dream Factory ②: 437123764

DT Big Data Dream Factory ③:418110145


Scala in the 84th: Scala in the list and Listbuffer design to realize the thinking after learning sense

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.