Scala collection: List adds elements and collection splicing operations

Increase data

+: And: +

Is the difference between adding at the front or at the back
Insert picture description here
Insert picture description here

By default, the collections provided by scala are immutable, and adding elements will produce a new collection.

++ Perform assembly stitching

Insert picture description here
Can be simplified to the following writing:
Insert picture description here

:: Add element in front

Insert picture description here
Insert picture description here
Can be understood as:
Insert picture description here

::: Set and set for element splicing

Insert picture description here

Empty collection

Insert picture description here

Published 1792 original articles · 1135 praises · 960,000 views

Guess you like

Origin blog.csdn.net/a772304419/article/details/105565265