参考地址:http://www.scala-lang.org/api/current/#scala.collection.immutable.$colon$colon
def ::(x: B): List[B]
- [use case] Adds an element at the beginning of this list.
Example:
1 :: List(2, 3) = List(2, 3).::(1) = List(1, 2, 3)x
the element to prepend.returns
a list which contains x as first element and which continues with this list.
def :::(prefix: List[B]): List[B]
- [use case] Adds the elements of a given list in front of this list.
Example:
List(1, 2) ::: List(3, 4) = List(3, 4).:::(List(1, 2)) = List(1, 2, 3, 4)prefix
The list elements to prepend.returns
a list resulting from the concatenation of the given list prefix and this list.