Take a look to the exercises that I solve in the test folder
✔️ Exercise 1: Basic usage of lambdas Description: Create a lambda expression that takes two integers and returns their sum.
✔️ Exercise 2: Using Function Description: Define a function that takes a string and returns its length using the Function interface.
✔️ Exercise 3: Using Predicate Description: Define a Predicate that takes an integer and returns true if it is even.
✔️ Exercise 4: Using Consumer Description: Define a Consumer that takes a string and prints it in uppercase.
✔️ Exercise 5: Using Supplier Description: Define a Supplier that returns a random string of 10 characters.
✔️ Exercise 6: Filtering a list Description: Filter a list of integers to keep only the even numbers using streams and Predicate.
✔️ Exercise 7: Mapping a list Description: Take a list of strings and use map to convert all strings to uppercase.
✔️ Exercise 8: Reducing a list Description: Use reduce to sum all the elements of a list of integers.
✔️ Exercise 9: Using flatMap Description: Take a list of lists of integers and use flatMap to convert it into a flat list of integers.
✔️ Exercise 10: Sorting a list Description: Sort a list of strings in reverse alphabetical order using streams.
✔️ Exercise 11: Using collect Description: Convert a list of strings into a single comma-separated string using Collectors.joining.
✔️ Exercise 12: Creating an infinite Stream Description: Use Stream.iterate to create an infinite stream of even numbers and take the first 10 elements.
✔️ Exercise 13: Using Optional Description: Use Optional to handle the possibility of null values when retrieving an element from a list.
❌ Exercise 14: Function composition Description: Combine two functions: one that multiplies a number by 2 and another that adds 3, and apply the composed function to a number.
❌ Exercise 15: Creating a Stream of objects Description: Create a Person class with name and age attributes. Then, create a stream of Person objects and filter those who are over 18 years old.
❌ Exercise 16: Grouping elements Description: Use Collectors.groupingBy to group a list of strings by their length.
❌ Exercise 17: Partitioning elements Description: Use Collectors.partitioningBy to divide a list of integers into even and odd numbers.
❌ Exercise 18: Counting elements Description: Use Collectors.counting to count the number of strings in a list.
❌ Exercise 19: Calculating statistics Description: Use Collectors.summarizingInt to obtain statistics (sum, average, max, min) from a list of integers.
❌ Exercise 20: Using parallelStream Description: Convert a list of integers into a parallelStream and find the sum of all elements.