aboutsummaryrefslogblamecommitdiff
path: root/tests/pos/collections.scala
blob: cd84f03d83c1a95fd8f980b17d2f8e2e6639bbf4 (plain) (tree)
1
2
3
4
5
6
7
8
9


                                            
  


                           

                            


                        
                                                                                            





                              
                                         


                                  







                                  
 
 
import scala.collection.generic.CanBuildFrom

object collections {
  
  val arr = Array("a", "b")
  val aa = arr ++ arr
 
  List(1, 2, 3) map (x => 2)

  val s = Set(1, 2, 3)
  val ss = s map (_ + 1)

  val cbf: CanBuildFrom[List, Int, List[Int]] = scala.collection.immutable.List.canBuildFrom

  val nil = Nil
  val ints1 = 1 :: Nil
  val ints2 = 1 :: 2 :: Nil
  val ints3: List[Int] = ints2
  val f = (x: Int) => x + 1
  val ints4: List[Int] = List(1, 2, 3, 5)
    
  val ys = ints3 map (x => x + 1)
  val zs = ys filter (y => y != 0)
  
  val chrs = "abc"
    
  def do2(x: Int, y: Char) = ()
  
  chrs foreach println
  
  (ints2, chrs).zipped foreach do2

}