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.
中文解释就是 => 数组1 ::: 数组2,表示在 数组2 的 首位 添加 数组1