#collections #lists #scala
Concatenating Lists:
You can use either ::: operator or List.:::() method or List.concat() method to add two or more lists.
If you want to change selection, open document below and click on "Move attachment"
Scala Listsve code is compiled and executed, it produces the following result:
C:/>scalac Test.scala
C:/>scala Test
Head of fruit : apples
Tail of fruit : List(oranges, pears)
Check if fruit is empty : false
Check if nums is empty : true
C:/>
<span>Concatenating Lists:
You can use either ::: operator or List.:::() method or List.concat() method to add two or more lists. Following is the example:
object Test {
def main(args: Array[String]) {
val fruit1 = "apples" :: ("oranges" :: ("pears" :: Nil))
val fruit2 = Summary
status | not read | | reprioritisations | |
---|
last reprioritisation on | | | suggested re-reading day | |
---|
started reading on | | | finished reading on | |
---|
Details