Java 8 Overview


The Major development feature in JAVA Programming Languages is released in the form of JAVA 8. It originated and came into the market on March 18, 2014. When the JAVA 8 is released after that, JAVA starts providing support for functional programming, new streaming API’S, for date-time manipulation new API’S are there, and a new javascript engine.

New Characteristics

  • Lambda Assertion: It adds functional clearing ability into JAVA.
  • Technique References: In this, it starts referencing functions by their names rather than entreating them directly. Start using functions as a parameter.
  • Default Routine: Adding default method implementation into the interface.
  • Latest Tools: Utilities and latest compiler tools are now added for example “jdeps” to check the dependencies.
  • Stream API: For smooth pipeline processing New stream API are there.
  • Date and Time API: Upgraded versions of date-time API’S are now available.
  • Non-Compulsory: Prominence to handle the best practice of null values Properly.
  • Nashorn, JavaScript engine: For the execution of JAVAScript Code a JAVA Based engine is there.

Think About the following code snippet:

import java.util.Collections;
import java.util.List;
import java.util.ArrayList;
import java.util.Comparator;

public class Java8Tester {

   public static void main(String args[]) {
      List<String> names1 = new ArrayList<String>();
      names1.add("Mahesh ");
      names1.add("Suresh ");
      names1.add("Ramesh ");
      names1.add("Naresh ");
      names1.add("Kalpesh ");
      List<String> names2 = new ArrayList<String>();

      names2.add("Mahesh ");
      names2.add("Suresh ");
      names2.add("Ramesh ");
      names2.add("Naresh ");
      names2.add("Kalpesh ");
      Java8Tester tester = new Java8Tester();
      System.out.println("Sort using Java 7 syntax: ");
      System.out.println("Sort using Java 8 syntax: ");

   //sort using java 7
   private void sortUsingJava7(List<String> names) {   
      Collections.sort(names, new Comparator<String>() {
         public int compare(String s1, String s2) {
            return s1.compareTo(s2);

   //sort using java 8
   private void sortUsingJava8(List<String> names) {
      Collections.sort(names, (s1, s2) -> s1.compareTo(s2));

After that, Run the program for the result as follows:

Sort using Java 7 syntax:

[ Kalpesh Mahesh Naresh Ramesh Suresh ]

Sort using Java 8 syntax:

[ Kalpesh Mahesh Naresh Ramesh Suresh ]

It is the SortUsingJava8() Method by using a sort function with a lambda expression as a variable to get the sorting criteria.