General Java 8 Features
• What is Java 8?
• What are the main features introduced in Java 8?
• Why was a new version of Java needed in the first place?
• What advantages does Java 8 bring?
• How does Java 8 handle backward compatibility?
Functional Programming Fundamentals
• What is a Lambda Expression, and why use it?
• What are the advantages of Lambda Expressions?
• What are the disadvantages of Lambda Expressions?
• What variables do lambda expressions have access to?
• What is a Functional Interface?
• How are functional interfaces and Lambda Expressions related?
• Tell a few functional interfaces which were already available before Java 8.
• What are all functional interfaces introduced in Java 8?
• What is method reference in Java 8?
• How does Java 8 help support functional programming?
• Can you declare an interface method static?
• How to call a default interface method in a class that implements this interface?
Stream API
• What is Stream API in Java 8?
• What is a Stream in Java 8?
• What is the purpose of Stream API?
• Describe the importance of the Stream API.
• Tell a few stream methods you used in your project.
• What is Stream Pipelining?
• Why do streams use forEach() and forEachOrdered() methods?
• What are sorting operations available in Java 8 streams?
• What are the selection operations available in the Java 8 Stream API?
• What are reducing operations? Name some of the reducing operations available in the Java 8
streams.
• What is the role of reduce in Streams?
Optional Class
• What is the Optional Class in Java 8?
• How does the Optional class help in handling null values in Java 8?
• Provide some Optional methods in Java 8.
• What is Optional equals() method in Java?
• What are some best practices for using Optional effectively? When should Optional be used,
and when should it be avoided?
Date and Time API (java.time)
• What is Date-Time API in Java 8?
• How does the new Date and Time API work?
• What are the key advantages of using the new Date and Time API over the older Date and
Calendar classes?
• List some Java 8 Date and Time APIs.
Concurrency and Advanced Topics
• What is CompletableFuture?
• What are the advantages of using CompletableFuture in Java 8?
• How do you ensure thread safety when working with Java 8 features such as streams and
CompletableFuture?
• How do you create and run a parallel stream in Java 8?
• How do you use parallel streams in Java 8 to improve performance for large datasets? What
are the risks associated with parallel streams?
• What is Nashorn, and what advantages does it provide?
• What is Metaspace in Java 8?
• What is a Spliterator?
Comparison and Differentiation
• Differentiate between Lambda Expressions and Anonymous Classes.
• What is the difference between Collection and Stream API?
• When to use map and flatMap?
• What is the difference between map() and peek() in the Stream API?
• Differentiate between Comparable and Comparator in Java.
• What is the difference between Function and BiFunction?
• What is the difference between a Predicate and a Function?
• What are the differences between Java 7 and Java 8?
Scenario-Based and Coding Challenges
• How would you process a list of transactions to filter and summarize data using Java
Streams?
• How would you refactor a piece of code to use lambda expressions and functional
interfaces?
• How would you use the new Date and Time API in Java 8 to calculate the difference between
two dates?
• How to iterate and modify values in a Map using Java 8?
• How to print keys & values of a Map using Java 8?
• How many ways are there to print keys & values of a Map?
• How to convert String to Date Object using Java 8?
• How many ways are there to initialize a Set?
• How to retrieve values from Set using Java 8?
• How to iterate a Map containing a List of String in Java 8?
• How to count occurrences of each character of a String in Java 8?
• How to find next/previous (tomorrow/yesterday) date using Java 8?
• How to remove all duplicates from an array of integers in Java using Java 8?
• How to count the number of occurrences of a given word in a list of strings using Java 8?
• How to filter an array of strings by a given prefix using Java 8 Stream?
• Write a Java program using Stream to create a map from a list of strings where the key is the
string and the value is its length?
• How to filter and collect a list of strings that start with a specific letter using Java 8 Stream?
• How to sort a list of strings by length using Lambda expressions?
• How to find the maximum value in a list of integers using Stream & Method Reference?
• Separate odd and even numbers in a list of integers.
• Remove duplicate elements from a list using Java 8 streams.
• Find the frequency of each character in a string using Java 8 streams.
• Find the frequency of each element in an array or a list.
• Sort a given list of decimals in reverse order.
• Join a list of strings with '[' as prefix, ']' as suffix, and ',' as delimiter.
• Print the numbers from a given list of integers that are multiples of 5.
• Find the maximum and minimum of a list of integers.
• Merge two unsorted arrays into a single sorted array using Java 8 streams.
• Merge two unsorted arrays into a single sorted array without duplicates.
• Get the three maximum and three minimum numbers from a given list of integers.
• Check if two strings are anagrams or not using Java 8 streams.
• Find the sum of all digits of a number in Java 8.
• Find the second largest number in an integer array.
• Sort a list of strings according to the increasing order of their length.
• Find the sum and average of all elements in an integer array.
• Find the common elements between two arrays.
• Reverse each word of a string using Java 8 streams.
• Find the sum of the first 10 natural numbers.
• Reverse an integer array.
• Print the first 10 even numbers.
• Find the most repeated element in an array.
• Check if a string is a palindrome using Java 8 streams.
• Find strings in a list that start with a number.
• Extract duplicate elements from an array.
• Print duplicate characters in a string.
• Find the first repeated character in a string.
• Find the first non-repeated character in a string.
• Generate the Fibonacci series.
• Print the first 10 odd numbers.
• Get the last element of an array.
• Calculate the age of a person in years.
• How do you print ten random numbers using forEach?
• How do you get the highest number that exists on a list?
• How do you get the second Friday of next month?
• Java 8 introduced several new methods like forEach(), removeIf(), and replaceAll() in the
Collection interface. Can you give examples of how you used them?