Examples:
- // normal way to make a Tuple2
- scala> (1,2)
- res3: (Int, Int) = (1,2)
- // another way to make a Tuple2 using the implicit -> method
- scala> 1 -> 2
- res2: (Int, Int) = (1,2)
- // Creating a map using the normal tuples creation mechanism
- scala> Map (("one",1),
- | ("two",2))
- res5: scala.collection.immutable.Map[java.lang.String,Int] = Map(one -> 1, two -> 2)
- // -> syntax allows a second "prettier" way of creating the Map
- scala> Map("one" -> 1,
- | "two" -> 2)
- res6: scala.collection.immutable.Map[java.lang.String,Int] = Map(one -> 1, two -> 2)
No comments:
Post a Comment