/java-8-demo

Demos of new features in Java 8

Primary LanguageJavaMIT LicenseMIT

java-8-demo

This project contains a bunch of demos presenting new features in Java 8. Each demo is class with the main method that you can run and see how it works.

What do I need to run the demos?

What's new in Java 8

Lambda Expressions

Lambda expressions let you define functions concisely and pass them as method arguments.

Examples of lambda expressions:

  • x -> x % 2 == 0
  • (s1, s2) -> s1.compareToIgnoreCase(s2)
  • () -> System.currentTimeMillis()

Default Methods

Default methods enable new functionality to be added to the interfaces of libraries and ensure binary compatibility with code written for older versions of those interfaces

Default Methods added to the standard library