/*
 * work.scala
 *
 * To change this template, choose Tools | Template Manager
 * and open the template in the editor.
 */

package misc

object work extends Application {
    import scala.collection.mutable._

    val countMap = new HashMap[Map[Int,Int], String]

    val key = HashMap(1 -> 2)
    countMap += (key -> "one")
    //countMap += 2 -> "two"
    //countMap += 3 -> "three"

    //    val countMap2 = new HashMap[Int, String]
    //    countMap2 += 21 -> "one"
    //    countMap2 += 22 -> "two"
    //    countMap2 += 23 -> "three"
    //
    //    countMap ++= countMap2
    for (key <- countMap.keySet) {
        println(key + ":" + countMap(key))
    }

    val list = List[Int]()

    // call-by-name
    //-------------------
    def nano() = {
        val t = System.nanoTime
        println("  Getting nano " + t)
        t
    }
    def delayed(t: => Long) {
        println("--- Start delayed")
        Thread.sleep(1234)
        println("  in delayed param:" + t)
        t
    }
    def notDelayed(t:Long) {
        println("--- Start notDelayed")
        Thread.sleep(1234)
        println("  in notDelayed param:" + t)
        t
    }
    delayed(nano())
    println("-----")
    notDelayed(nano())

    //
    println( (0 to Integer.MAX_VALUE - 1).take(5))
}
