Chapter 15. Blending OOP and FP: comparing Java 8 and Scala

This chapter covers

  • An introduction to Scala
  • How Java 8 relates to Scala and vice versa
  • How functions in Scala compare to Java 8
  • Classes and traits

Scala is a programming language that mixes object-oriented and functional programming. It’s often seen as an alternative language to Java for programmers who want functional features in a statically typed programming language that runs on the JVM while keeping a Java feel. Scala introduces many more features compared to Java: a more sophisticated type system, type inference, pattern matching (as presented in section 14.4), constructs to simply define domain specific languages, and so on. In addition, you can access all Java libraries ...

Get Java 8 in Action: Lambdas, streams, and functional-style programming now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.