You are currently viewing Java 8 features

Java 8 features

  • Post author:
  • Post category:Java
  • Post comments:2 Comments
  • Post last modified:February 25, 2024

Oracle released a new version of Java as Java 8 in March 18, 2014. It was a revolutionary release of the Java for software development platform. It includes various upgrades to the Java programming, JVM, Tools and libraries.

Java 8 provides following features for Java Programming:

  • Lambda expressions,
  • Method references,
  • Functional interfaces,
  • Stream API,
  • Default methods,
  • Base64 Encode Decode,
  • Static methods in interface,
  • Optional class,
  • Collectors class,
  • ForEach() method,



Lambda expression

Lambda expression helps us to write our code in functional style. It is very useful in collection library in which it helps to iterate, filter and extract data.

forEach

Java provides a new method forEach() to iterate the elements. It is defined in Iterable and Stream interfaces.

Optional

Java introduced a new class Optional in Java 8. It is a public final class which is used to deal with NullPointerException in Java application.

Method reference

Java 8 Method reference is used to refer method of functional interface . It is compact and easy form of lambda expression.

Stream API

Java 8 java.util.stream package consists of classes, interfaces and an enum to allow functional-style operations on the elements.

Collectors

Collectors is a final class that extends Object class. It provides reduction operations, such as accumulating elements into collections, summarizing elements according to various criteria etc.

Base64

Java provides a class Base64 to deal with encryption and decryption.

DateTime API

Java has introduced a new Date and Time API since Java 8. The java.time package contains Java 8 Date and Time classes.

Static methods in interface

Default methods

Java provides a facility to create default methods inside the interface.

This Post Has 2 Comments

  1. HDPE pipe solutions

    Nice blog here! Also your site loads up very fast! What host are you using? Can I get your affiliate link to your host? I wish my site loaded up as quickly as yours lol

Leave a Reply