Friday, November 7, 2014

Scala Vs Java

Scala has a set of features, which differ from Java. Some of these are:
note: few of them got introduced in Java 1.8
  • All types are objects. (Int, Short, Long, Byte etc.)
  • Type inference. (val s = "scala". s is of type string which will be determined by scala compiler at runtime)
  • Nested Functions. def f { def b { ) }  } )
  • Functions are objects.
  • Domain specific language (DSL) support.
  • Traits. 
  • Closures. ( val s = "is awesome"; val o = Option("scala").map { _ + s} ) 
  • Lambdas 

  • Concurrency support inspired by Erlang. { package scala.actors.Actor._ }

  • Case Class

  • Implicit conversion ( implicit def toString(i: Int) = i.toString )


No comments:

Post a Comment