Java 8 Tutorial
This is a complete guide to Java 8 features, enhancements, date and time API, and coding examples. The examples from this tutorial are tested in our local development environment. You can simply clone from Github and try to use it in your projects or practice.
New Tutorials added (2020)
- Java 8 Stream Tutorial for Beginners
- Java 8 Stream - Creating Stream Objects Example
- Java 8 Stream - filter() and forEach() Example
- Java 8 Lambda - Sort List in Ascending and Descending Order | Comparator Example
- Java Sort List (ArrayList) in Ascending and Descending Order using Java 8 Stream API
- Java Sort Array Objects using Comparable Interface
- Java Sort an Array of Objects in Ascending and Descending Order using Java 8 Lambda
Key Features of Java 8
In this tutorial, we will learn the following important keys features that came in Java 8:
1. Java 8 Main Features
- Java 8 Lambda Expressions
- Java 8 Functional Interfaces
- Java 8 Method References
- Java 8 Stream API
- Java 8 Optional Class
- Java 8 Collectors Class
- Java 8 StringJoiner Class
- Java 8 Static and Default Methods in Interface
2. Java 8 Predefined Functional Interfaces Examples
- Java 8 Function Interface Example
- Java 8 Predicate interface Example
- Java 8 Consumer Interface Example
- Java 8 Supplier Interface Example
- Java 8 BiFunction Example
- Java 8 BiConsumer Example
- Java 8 BiPredicate Example
- All Java 8 Functional Interfaces
- Java @FunctionalInterface Annotation
3. Java 8 Stream API Examples
- Java 8 Stream Tutorial for Beginners
- Java 8 Stream - Creating Stream Objects Example
- Java 8 Stream - filter() and forEach() Example
- Java 8 Lambda - Sort List in Ascending and Descending Order | Comparator Example
- Java Sort List (ArrayList) in Ascending and Descending Order using Java 8 Stream API
- Java 8 Stream APIs with Examples
- Ways of Creating a Stream in Java 8
- Collections Aggregate Operations
- Stream Reduction Operations
- How to Use Java 8 Stream API in Java Projects
- Different Ways to Iterate over List, Set and Map in Java
4. Java 8 Coding Examples
- Factory Pattern Using Java 8 Lambda Expressions
- Java 8 - Merging Two Maps Example
- Java 8 Convert List to Map Example
- Guide to Java 8 forEach Method
- Handle NullPointerException using Java 8 Optional Class
- How to Use Java 8 Stream API in Java Projects
- Migrating Source Code to Java 8
- Refactoring Observer Design Pattern with Lambdas
- Refactoring Strategy Design Pattern with Lambdas
- Refactoring Chain of Responsibility Pattern with Lambdas
5. Java 8 Sorting
- Java 8 Lambda - Sort List in Ascending and Descending Order | Comparator Example
- Java Sort List (ArrayList) in Ascending and Descending Order using Java 8 Stream API
- Java Sort Array Objects using Comparable Interface
- Java Sort an Array of Objects in Ascending and Descending Order using Java 8 Lambda
6. Java 8 Date and Time API Guide
¶6.1 Java 8 Date and Time Overview
- Java 8 Date Classes with Examples
- Java 8 Date and Time Classes with Examples
- Java 8 Date Parsing and Formatting with Examples
- Java 8 Time Zone and Offset Classes with Examples
¶6.2. Java 8 Date & Time API Guide
- Java 8 - LocalTime Class API Guide
- Java 8 - LocalDate Class API Guide
- Java 8 - LocalDateTime Class API Guide
- Java 8 - ZonedDateTime Class API Guide
- Java 8 - Duration Class API Guide
- Java 8 - Instant Class API Guide
- Java Clock Class Methods/APIs with Examples
- Java Period Class Methods/APIs with Examples
- Java Year Class Methods/APIs with Examples
- Java DayOfWeek Enum Methods with Examples
- Java Month Enum Methods/APIs with Examples
¶6.3 Utilities
7. Reference links
- Java 8 Developer Guide(Oracle site)
- Java 8 API Documentation
- Java 8 Aggregate Operations(Oracle site)
- Java 8 New and Enhanced APIs
- Java 8 Tips and Best Practices