servlets struts hibernate jsf spring maven
 

Java 8 - Overview


JAVA 8 is a major element arrival of JAVA programming.Java SE 8 was released in mid 2014. In Java 8, about element was lambda expressions.

Java 8 discharge, Java gave backings to utilitarian programming stream API and new date/time API.

what is New Features of Java 8?

  • Lambda expression − Lambda expressions are not obscure to huge numbers of us who have taken a shot at other famous programming programming like Scala. Adds practical preparing ability to Java.

  • Functional Interface - Functional interfaces are additionally called Single Abstract Method interfaces (SAM Interfaces). license precisely one unique strategy

  • Default method − Interface to have default technique implementation.

  • Stream API − Streams API in Java 8 bolsters an alternate kind of cycle where you basically characterize the arrangement of things to be handled, the operation(s) to be performed on every thing, and where the yield of those activities is to be put away. New stream API to encourage pipeline processing.

  • Date Time API − Improved date time API.

Consider the accompanying 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("Jhonson "); 

names1.add("David "); 

names1.add("Angilina "); 

names1.add("Punit "); 

names1.add("Jhon "); 

List<String> names2 = new ArrayList<String>(); 

names2.add("Jhonson "); 

names2.add("David "); 

names2.add("Angilina "); 

names2.add("Punit "); 

names2.add("Jhon "); 

Java8Tester analyzer = new Java8Tester(); 

System.out.println("Sort utilizing Java 7 grammar: "); 

tester.sortUsingJava7(names1); 

System.out.println(names1); 

System.out.println("Sort utilizing Java 8 grammar: "); 

tester.sortUsingJava8(names2); 

System.out.println(names2); 

} 

//sort utilizing java 7 

private void sortUsingJava7(List<String> names) { 

Collections.sort(names, new Comparator<String>() { 

@Override 

public int compare(String s1, String s2) { 

return s1.compareTo(s2); 

} 

}); 

} 








javacodegeeks is optimized for learning.© javacodegeeks .
All Right Reserved and you agree to have read and accepted our term and condition

JAVACODEGEEKS
EmberJS Tutorial