List[Double](1,2,3) //List(1.0, 2.0, 3.0) (result)
List[String]("A","B","C") //List(A, B, C) (result)
This information is not available at runtime.
Instead are types are replaced with "Any" type- rest of code can affect processing only by giving input - functions can affect rest of code only by result
- contains foreach method
- might be strict (List) or non-strict (Stream)
- might be ordered (Seq) or non-ordered (Set)
- immutable
- operations on collection return new updated structure
- updated structure reffers to original and contains only differences
- memory efficient
val items1 = List(1,2,3) val items2 = items1.updated(1, "A")- there's no way to modify original collection (items1)
- though update method returns new collection (items2)
- new collection contain only changes and reference to original
- old items are shared by both collections
Simple programming enviroment where user enters expressions, next they are evaluated, results are printed and process is repeated.
scala
Welcome to Scala version 2.10.3 (Java HotSpot(TM) 64-Bit Server VM, Java 1.6.0_25).
Type in expressions to have them evaluated.
Type :help for more information.
scala> println("Hello world")
Hello world
scala> exit
No comments:
Post a Comment