Java Streams provide a functional approach to processing collections of objects. They enable concise and expressive code for operations like filtering, mapping, sorting, and more. This repository demonstrates several common tasks solved using Java Streams.
-
Sum of Even Numbers Calculate the sum of all even numbers in a list of integers.
-
Count Strings by Length Find and print the count of strings with a length greater than 5.
-
Square of Elements Implement a function to return a new list containing the square of each element in a list of integers.
-
Maximum Element Find the maximum element in a list of integers.
-
Concatenation of Strings Concatenate all strings in a list into a single string.
-
Uppercase and Sort Strings Convert each string to uppercase and then sort them alphabetically.
-
Average of Doubles Calculate the average of all numbers in a list of doubles.
-
Unique Words Create a new list containing only unique words by removing duplicates.
-
Check Condition for All Elements Check if all elements in a list satisfy a given condition.
-
Check Element Existence Check if a list contains a specific element.
-
Longest String Find the longest string in a list.
-
Remove Null Values Remove null values from a list.
-
Second-Smallest Element Find the second-smallest element in a list.
Contributions are welcome! If you have any improvements or new examples to add, feel free to submit a pull request.