Scala Add To List

[Solved] Scala Add To List | Scala - Code Explorer | yomemimo.com
Question : scala add to list

Answered by : illai

def::[B >: A](elem: B): List[B]
Adds an element at the beginning of this list.	elem is the element to prepend.	returns a list which contains x as first element	and which continues with this list.
Example:
1 :: List(2, 3) = List(2, 3).::(1) = List(1, 2, 3)

Source : | Last Update : Fri, 13 Nov 20

Answers related to scala add to list

Code Explorer Popular Question For Scala