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).
More Related Contents:
- Creating a specific pattern with two-dimensional array in scala
- Printing array in Scala
- How to pass Scala array into Scala vararg method?
- How to create and use a multi-dimensional array in Scala?
- Why are Arrays invariant, but Lists covariant?
- Why does `Array(0,1,2) == Array(0,1,2)` not return the expected result?
- Access Array column in Spark
- How to convert an Array to a Tuple?
- maximize the top element of the stack after performing exactly K operations
- How to Update Multiple Array Elements in mongodb
- How to split a string into an array in Bash?
- Repeat copies of array elements: Run-length decoding in MATLAB
- Using transpose versus ctranspose in MATLAB
- Get random elements from array in Swift
- Why are the elements of an array formatted as zeros when they are multiplied by 1/2 or 1/3?
- How to find the kth smallest element in the union of two sorted arrays?
- How can I extend typed Arrays in Swift?
- Can min/max of moving window achieve in O(N)?
- Exporting an array in bash script
- Find the majority element in array
- What is the difference between a slice and an array?
- the best way to make codeigniter website multi-language. calling from lang arrays depends on lang session?
- Are there other common “c-like” or non “c-like” languages with non zero index array position? [closed]
- Why does gulp.src not like being passed an array of complete paths to files?
- Convert bytes/UInt8 array to Int in Swift
- VBA using ubound on a multidimensional array
- Temporarily transmute [u8] to [u16]
- How to find the length of an array in shell?
- Multidimensional arrays in Swift
- Matching up two vectors in R