In the example below, why do these methods have a different type and how do their types differ?
Int => Int //is a shortcut for
Function1[Int, Int].
But why does a method has a different type and what is the difference between (i: Int): Int
and Int => Int
?
Can a function have a similar type like in the first example?
scala> :t def double(i: Int): Int = i * 2
(i: Int): Int
scala> :t def double: Int => Int = i => i * 2
Int => Int
scala> val double2 : Int => Int = i => i * 2
val double2: Int => Int = $Lambda$1197/0x00000008010c8400@54398386
scala> :t double2
Int => Int