Skip to content

sumitppawar/JavaEight

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Java 8

Introduction to new things in java 8.

Use link to see example of relevant title.

What is lambda expression ?

Lambda expression is nothing but an anonymous function.
Functional Interface is an Interface having only one abstract method.
Default static method method with default static and defined in an interface. 
java.util.function.*
java.util.function.Predicate
java.util.function.Consumer

Method Reference

list.forEach(p -> Person::getInfo)
list.forEach(p -> personObject::getInfo)
Way to deal with null value.
java.util.Optional.of(new Person(23, "Sumit"))
forEach(Consumer con) method added to collection  

Stream API

Traveling and aggregating collection sequentially.
new ArrayList(). stream()
Traveling and aggregating collection parallel.
new ArrayList(). parallelStream()

Time API

//The Classes
java.util.Instance
java.util.Duration
java.util.LocalTime
java.util.LocalDate
java.util.LocalDateTime
java.util.DateTimeFormatter
java.util.DateTimeFormatterBuilder
Dealing with time and date without time zone information.
How for format date and time using DateTimeFormatter ?
Date and Time with zone information.
//nashorn command line using jjs
Sumits-MacBook-Air:~ sumit$ jjs
jjs> var welcome = 'Welcome to Nashorn';
jjs> welcome 
How execute javscript file using nashorn ?

Improvements

Adding delimiter between string. join() static method on string. 
Joining using  java.util.StringJoiner class. We can add delimiter, prefix, suffix

About

Introduction to new things in java 8

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published