This page contains a list of Java 8 programs and examples to cover the important features of Java 8. The important Java features include Lambda expressions, Stream API, Functional interfaces, Date and Time API, Optional class, and more.
Java 8 String Manipulation Programs and Examples
- Java 8 – Count Duplicate Characters in a String
- Java 8 – Count Occurrences of Each Word in a String
- Java 8 – Find the First Non-Repeated Character in a String
- Java 8 – Reverse a String Using Streams
- Java 8 – Check if Two Strings are Anagrams
- Java 8 – Remove Vowels from a String
- Java 8 – Find the Longest Word in a String
- Java 8 – Count Vowels and Consonants in a String
- Java 8 – Split a String by Delimiter
- Java 8 – Capitalize the First Letter of Each Word in a String
- Java 8 – Find Duplicate Words in a String
- Java 8 – Find All the Permutations of a String
- Java 8 – Count the Occurrences of Each Character
- Java 8 – Count the Number of Duplicate Words in a String
- Java 8 – Count the Number of Words in a Given String
- Java 8 – Count the Number of Occurrences of a Substring in a String
- Java 8 – Merge Two String Arrays
- Java 8 – Remove Duplicate Words from a String
- Java 8 – Reverse Each Word of a String
- Java 8 – Swap Two Strings
- Java 8 – Check if the String Contains Only Digits
- Java 8 – Check if the String Contains Only Letters
- Java 8 – Check If the String Contains Only Letters or Digits
- Java 8 – Remove All Whitespaces from a String
- Java 8 – Check if a String is Empty or Null
- Java 8 – Find Maximum Occurring Character in a String
- Java 8 – Add Characters to a String
- Java 8 – Check if a Year is a Leap Year
- Java 8 – Count the Occurrences of Each Character Using HashMap
Java 8 Programs and Examples on Collections Framework
- Java 8 – Sort a List Using Streams
- Java 8 – Filter a List Using Streams
- Java 8 – Convert List to Map
- Java 8 – Merge Two Lists Using Streams
- Java 8 – Count Elements in a List
- Java 8 – Convert List to Set
- Java 8 – Convert List to Array
- Java 8 – Find Maximum Value in a List
- Java 8 – Find Minimum Value in a List
- Java 8 – Check if a List Contains an Element
- Java 8 – Find the First Element in a List
- Java 8 – Get the Last Element from a List
- Java 8 – Sort a List of Objects by Multiple Fields
- Java 8 – Partition a List Using Streams
- Java 8 – Join List Elements into a String
- Java 8 – Remove Null Values from a List
- Java 8 – Shuffle Elements in a List
- Java 8 – Flatten Collections with FlatMap
- Java 8 – Create an Immutable List
- Java 8 – Convert a Collection to a String
- Java 8 – Convert List to Set
- Java 8 – Convert Set to String
- Java 8 – Convert Set to Array
- Java 8 – Convert Set to List
- Java 8 – Convert Set to Comma-Separated String
- Java 8 – Create Set from Array
- Java 8 – Create a Set from List of Objects
- Java 8 – Create an Immutable Set
- Java 8 – Merge Two Maps
- Java 8 – Sort a Map by Key
- Java 8 – Sort a Map by Value
- Java 8 – Filter a Map by Key
- Java 8 – Convert Map to List
- Java 8 – Convert List to Map Using Collectors
- Java 8 – Iterate Over a Map
- Java 8 – Find the Maximum Value in a Map
Java 8 Programs and Examples on Stream API
- Java 8 – Filter a Stream Using Lambda Expressions
- Java 8 – Sort a Stream of Objects
- Java 8 – Convert List to Stream
- Java 8 – Convert Stream to List
- Java 8 – How to Use Stream.map() to Transform Data
- Java 8 – Grouping Elements Using Stream Collectors
- Java 8 – Use FlatMap to Flatten Streams
- Java 8 – Find First and Any Elements in a Stream
- Java 8 – Create Streams from Arrays
- Java 8 – Parallel Streams for Multithreading
- Java 8 – Stream.filter() with Examples
- Java 8 – Stream.forEach()
- Java 8 – Remove Duplicates from a Stream
- Java 8 – Convert Stream to Set
- Java 8 – Skip and Limit in Streams
- Java 8 – How to Merge Multiple Streams
- Java 8 – Handle Null Values in Streams
- Java 8 – Convert Stream to Map
- Java 8 – Convert Stream to Map
Java 8 File and I/O Operations
- Java 8 – Read a File Line by Line
- Java 8 – Write to a File Using Streams
- Java 8 – List All Files in a Directory
Java 8 Date and Time API
- Java 8 – How to Get the Current Date and Time
- Java 8 – Convert String to LocalDate
- Java 8 – Convert String to LocalDateTime
- How to Format Dates in Java 8
- Java 8 – How to Compare Two Dates
- Java 8 – Add or Subtract Days, Months, and Years
- Java 8 – Convert LocalDate to LocalDateTime
- Java 8 – Convert LocalDateTime to LocalDate
- Java 8 – Convert Between Time Zones
- Java 8 – How to Get the Start and End of the Day
- Java 8 – Difference Between Two Dates
- Java 8 – Convert LocalDateTime to Timestamp
- Java 8 – How to Format LocalDateTime
- Java 8 – How to Add Days to the Current Date
- Java 8 – Convert Instant to LocalDateTime
- Java 8 – How to Parse LocalDateTime
- Java 8 – Check if a Year is a Leap Year
- Java 8 – Get the Current Timestamp
- Java 8 – Format LocalDate to dd/MM/yyyy
- Java 8 – Convert LocalDate to Date
- Java 8 – How to Add Hours to Time
- Java 8 – Get the First Day of the Month
- How to Get the Next Day in Java
- Java – Format LocalDate to dd-MM-yyyy
- Java – Format LocalTime to HH:mm:ss
- Java – Format LocalDateTime to dd-MM-yyyy HH:mm:ss
- Java – Format LocalDateTime to dd/MM/yyyy HH:mm:ss
- Java 8 – Convert LocalDateTime to Epoch Milliseconds
- Java 8 – Convert LocalDateTime to Instant
- Java 8 – Convert LocalDateTime to ZonedDateTime
- Java 8 – Find the Day of the Week for a Given Date
- Java 8 – Convert Timestamp to LocalDateTime
- Java 8 – Convert LocalDateTime to Timestamp
- Java 8 – Calculate Age from Birthdate
- Java 8 – Convert Date to LocalDate
- Java 8 – Convert Date to LocalDate
- Java 8 – How to Get the Number of Days Between Two Dates
- Java 8 – How to Get the Current Time in Milliseconds
- Java 8 – How to Get the First and Last Day of the Month
- Java 8 – Difference Between LocalDate, LocalTime, and LocalDateTime
- Java – Get Year, Month, Day, Hours, Minutes, Seconds, and Milliseconds of LocalDateTime
Java 8 Lambda Expressions
- Java 8 – Implement Runnable Using Lambda
- Java 8 – Sort a List Using Lambda Expression
- Java 8 – Filter a Map by Key Using Lambda
- Java 8 – Filter a Map by Value Using Lambda
- Java 8 – Implement Comparator Using Lambda
- Java 8 – Iterate a Map Using Lambda
- Java 8 – Remove Null Values from a List Using Lambda
- Java 8 – Filter a List of Objects with Lambda Expressions
- Java 8 – Convert a List to a Map Using Lambda Expressions
- Java 8 – How to Chain Lambda Expressions for Complex Operations
- Java 8 – How to Use Lambda Expressions to Sort by Multiple Fields
- Java 8 – How to Handle Exceptions in Lambda Expressions
- Java 8 – How to Remove Duplicates from a List with Lambda
- Java 8 – Find Maximum and Minimum Values Using Lambda Expressions
Java 8 Optional
- Java 8 – Avoid NullPointerException Using Optional
- Java 8 – Get Value from Optional
- Java 8 – Check if Optional is Present
- Java 8 – Provide Default Value Using Optional
- Java 8 – Filter a List Using Optional
- Java 8 – How to Create a Custom Functional Interface
- Java 8 – Implement Runnable with Lambda Expressions
- Java 8 – Implement Comparator Using Functional Interfaces
- Java 8 – How to Implement Callable with Functional Interface
- Java 8 – How to Use Optional in Java
- Java 8 – How to Group By in Stream API
- Java 8 – How to Use forEach in Streams
- Java 8 – Parallel Streams Example
- Java 8 – How to Merge Two Lists Using Streams
- Java 8 – How to Use map and flatMap in Streams
- Java 8 – Stream API for File I/O Operations
- Java 8 – How to Check if a String is Numeric
- Java 8 – Convert List of Objects to List of Strings
- Java 8 – How to Use Streams to Sum a List of Numbers
- Java 8 – How to Use Streams to Sum a List of Numbers
Java 8 Programs on Employee Management System (Interview Q&A)
- Java 8 – Count Male and Female Employees in the Organization
- Java 8 – Print the Name of All Departments in the Organization
- Java 8 – Group Employees by City
- Java 8 – Group Employees by Age
- Java 8 – Print Employee Details Whose Age Is Greater Than 25
- Java 8 – Find Maximum Age of Employee
- Java 8 – Print Average Age of Male and Female Employees
- Java 8 – Print the Number of Employees in Each Department
- Java 8 – Find the Department with the Highest Number of Employees
- Java 8 – Find the Average Salary of Each Department
- Java 8 – Find the Average Salary of Each Department
- Java 8 – Print Average and Total Salary of the Organization
- Java 8 – Find the Highest Salary in the Organization
- Java 8 Program to Calculate Salary of an Employee
- Java 8 – Find the Second Highest Salary in the Organization