List(1,2,3) :+ 4
Results in List[Int] = List(1, 2, 3, 4)
Note that this operation has a complexity of O(n). If you need this operation frequently, or for long lists, consider using another data type (e.g. a ListBuffer).
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…