Java 8 Tutorials

java 8 logo

A series of Java 8 tips and examples, hope you like it.

FAQs

1. Functional Interface

2. Streams

3. New Date Time APIs

In the old days, we use Date and Calendar APIs to represent and manipulate date.

  • java.util.Date – date and time, print with default time-zone.
  • java.util.Calendar – date and time, more methods to manipulate date.
  • java.text.SimpleDateFormat – formatting (date -> text), parsing (text -> date) for date and calendar.

Java 8 created a series of new date and time APIs in java.time package. (JSR310 and inspired by Joda-time).

  • java.time.LocalDate – date without time, no time-zone.
  • java.time.LocalTime – time without date, no time-zone.
  • java.time.LocalDateTime – date and time, no time-zone.
  • java.time.ZonedDateTime – date and time, with time-zone.
  • java.time.DateTimeFormatter – formatting (date -> text), parsing (text -> date) for java.time.
  • java.time.Instant – date and time for machine, seconds passed since the Unix epoch time (midnight of January 1, 1970 UTC)
  • java.time.Duration – Measures time in seconds and nanoseconds.
  • java.time.Period – Measures time in years, months and days.
  • java.time.TemporalAdjuster – Adjust date.
  • java.time.OffsetDateTime – {update me}

Examples…

4. Java 8 Tips

Installation

References

About the Author

author image
mkyong
Founder of Mkyong.com, love Java and open source stuff. Follow him on Twitter. If you like my tutorials, consider make a donation to these charities.

Comments

avatar
22 Comment threads
3 Thread replies
1 Followers
 
Most reacted comment
Hottest comment thread
25 Comment authors
CongNeha JainbvdsDaniel Meleroadam Recent comment authors
newest oldest most voted
Mrinmoy Dey
Guest
Mrinmoy Dey

From last 5 years,I am referring Mkyong.com whenever I need help. Thanks..

don k4sperski
Guest
don k4sperski

Excellent java 8 resources

Ngoc Khuong
Guest
Ngoc Khuong

Thank you :)))

lucas
Guest
lucas

can’t say anything for article. tks so much. love u

prem
Guest
prem

One of the most important features of lambdas is behind the scenes it supports optimisation using invokedynamic. Also the streams api does very well when used in parallel mode on multi cpu, multi core machines. I found more about that here
https://stackrules.com/learn-java-8-streams-api-in-an-hour/

Bimal Parajuli
Guest
Bimal Parajuli

I have been referring to this website for a long time ago. I like the way information is shared on this website. The explanation of the requirement and scenario is very clearly documented. The font-size, color combination, text format and wrapper of the code is eye-catching. I would use this website because it has a clear explanation of the topic and solution. It has good examples written in pretty understandable, easy and simple language. Usually, I don’t write the review for any of the websites that I follow but this website has helped me a lot on solving my project… Read more »

Tu Hoa Tri
Guest
Tu Hoa Tri

May be you lack of “match” method…

duliu
Guest
duliu

Good

Anirban Chatterjee
Guest
Anirban Chatterjee

StackOverflow and MkYoung you are next to Oracle(Sun) when it is about Java 🙂

Smithb636
Guest
Smithb636

hi!,I love your writing so much! share we communicate more approximately your post on AOL? I need an expert in this space to resolve my problem. Maybe that’s you! Looking forward to peer you. kabackkckkebkbce

zako
Guest
zako

Nice tutorial !

sathyamurthy
Guest
sathyamurthy

Hi
Thank you so much and please provide source code too.
Sathya

Madhu
Guest
Madhu

Very good java 8 resource.

Kondalarao
Guest
Kondalarao

Nice examples.. Thank you

srini
Guest
srini

where is the definition for Developer.java?

adam
Guest
adam

Great explanations , do you offer training ?

Daniel Melero
Guest
Daniel Melero

Thanks, you are the man!

bvds
Guest
bvds

Great!

Neha Jain
Guest
Neha Jain

A very trustworthy study resource. Thanks a ton!

Cong
Guest
Cong

thank you 😀 😀 😀

yahoo
Guest
yahoo

hgh

arasu
Guest
arasu

try to add all methods in java8 otherwise super.

cebulak
Guest
cebulak

I never paid and I will never pay for your tutorials, donations are not for open source people!

shaikh
Guest
shaikh

Hey he cebulak, he is not asking to donate money for himself.He is asking if you want then you can donate to charity organizatons like Unicef,

Featured Posts