Problems
Basic Problems
Convert List to Uppercase
List<String> strList = List.of("Apple", "banana", "Orange", "Avocado");
List<String> strListUpperCase = strList.stream().map(String::toUpperCase).toList();Filter Even Numbers
List<Integer> intList = List.of(1, 2, 3, 4, 5, 6, 7, 8, 9, 10);
List<Integer> intListEven = intList.stream().filter(n -> n % 2 == 0).toList();Count Strings Starting with ‘A’
List<String> strList = List.of("Apple", "banana", "Orange", "Avocado");
long strListStartsWithA = strList.stream().filter(str -> str.startsWith("A")).count();Find Maximum Number
Find Minimum Number
Calculate Sum
Check if All Elements are Positive
Concatenate List of Strings
Sort a List
Remove Duplicates from List
Intermediate Problems
Find Second Highest Number
Group Strings by Length
Partition List into Even and Odd
Find First Non-Repeating Character
Convert List of Strings to Map
Find the Most Frequent Element
Find the First Three Elements
Find All Palindromes
Sort Employees by Salary
Convert List of Strings to a Single String
Advanced Problems
Find the Longest Word
Find the Average Salary of Employees
Group Employees by Department
Find the Oldest Employee in Each Department
Find Duplicate Elements in a List
Convert a List of Employees into a Map
Find the Youngest Employee
Find the Longest and Shortest Words in a Sentence
Find the Average Age of Employees by Department
Count the Occurrences of Each Character in a String
Flatten a List of Lists
Find Top 3 Highest Salaries
Convert a List of Objects to JSON String
Find All Employees Older Than 30 and Sort by Salary
Find the Median Salary
Sort a List of Employees by Multiple Criteria
Find the First N Prime Numbers
Calculate Factorial Using Streams
Check if a String is an Anagram of Another String
Find the Kth Largest Element in a List
Generate a Fibonacci Series Using Streams
Find the Most Expensive Product in Each Category
Find Most Common Words in a Paragraph
Merge Two Sorted Lists into One Sorted List
Check if a Sentence is a Pangram
Find the Sum of All Even-Indexed Elements in a List
Simulate a Voting System Using Streams
Last updated