MCPcopy Create free account

hub / github.com/ZahidFKhan/Streams-API-Practices / types & classes

Types & classes99 in github.com/ZahidFKhan/Streams-API-Practices

ClassA_CountEvenNumbers
Count even numbers: <p>Example: <br> Input = [1,2,3,4,5,6]<br> Output = 3 <br> Explanation: (2, 4, 6) are even numbers.
src/test/java/com/github/streams/practice/a_easy_problems/numbers/A_CountEvenNumbers.java:16
ClassA_GenerateAPrimeNumberStream
src/test/java/com/github/streams/practice/c_hard_problems/numbers/A_GenerateAPrimeNumberStream.java:8
ClassA_Lambdas
This set of exercises is about lambdas and method references. You will write a lambda or method reference corresponding to each of several different f
src/test/java/com/github/streams/practice/functional_interfaces/solutions/A_Lambdas.java:19
ClassA_MatchesNoOfVowelsTest
Finds the words with the given number of vowels in a given string. <br> <br> Example: <pre> "The quick brown fox jumps right over the little lazy do
src/test/java/com/github/streams/practice/a_easy_problems/strings/A_MatchesNoOfVowelsTest.java:34
ClassA_MatchesNoOfVowelsTest
Finds the words with the given number of vowels in a given string. <br> <br> Example: <pre> "The quick brown fox jumps right over the little lazy do
src/test/java/com/github/streams/practice/b_medium_problems/strings/A_MatchesNoOfVowelsTest.java:34
ClassA_MinSalaryInEachDept
src/test/java/com/github/streams/practice/b_medium_problems/employee/A_MinSalaryInEachDept.java:25
ClassA_PredicateTest
src/test/java/com/github/streams/practice/functional_interfaces/A_PredicateTest.java:8
ClassA_SumOfNumbers
src/test/java/com/github/streams/practice/b_medium_problems/numbers/A_SumOfNumbers.java:16
ClassB_Comparators
Exercises to create comparators using lambda expressions and using the Comparator combinators. Some of the exercises use a Person class, which is a si
src/test/java/com/github/streams/practice/functional_interfaces/solutions/B_Comparators.java:15
ClassB_FunctionTest
src/test/java/com/github/streams/practice/functional_interfaces/B_FunctionTest.java:9
ClassB_LargestWordTest
src/test/java/com/github/streams/practice/a_easy_problems/strings/B_LargestWordTest.java:7
ClassB_LargestWordTest
src/test/java/com/github/streams/practice/b_medium_problems/strings/B_LargestWordTest.java:7
ClassB_LengthOfLargestConsecutiveSequence
src/test/java/com/github/streams/practice/c_hard_problems/numbers/B_LengthOfLargestConsecutiveSequence.java:35
ClassB_MapCelsiusToFahrenheit
Exercise focusing on the Stream.map() function. The goal is to convert a list of temperatures from Celsius (Integers) to Fahrenheit (Doubles) using th
src/test/java/com/github/streams/practice/a_easy_problems/numbers/B_MapCelsiusToFahrenheit.java:18
ClassB_MaxSalaryInEachDept
src/test/java/com/github/streams/practice/b_medium_problems/employee/B_MaxSalaryInEachDept.java:25
ClassB_SumOfUniqueNumbers
Calculates the sum of unique elements in an array. <br> Example: <br> Input: [5, 6, 7, 8, 5, 5, 8, 8, 7]<br> Output: 26
src/test/java/com/github/streams/practice/b_medium_problems/numbers/B_SumOfUniqueNumbers.java:16
ClassC_ConsumerTest
src/test/java/com/github/streams/practice/functional_interfaces/C_ConsumerTest.java:12
ClassC_DefaultMethodsTest
This set of exercises covers new default methods on the Collections and related APIs.
src/test/java/com/github/streams/practice/functional_interfaces/solutions/C_DefaultMethodsTest.java:16
ClassC_LengthOfCityTest
Calculates the length of city names that start with 'm' or 'M' and returns a map of city name to its length. <p>Example: <br> Input: ["Mumbai", "Munn
src/test/java/com/github/streams/practice/a_easy_problems/strings/C_LengthOfCityTest.java:19
ClassC_LengthOfCityTest
Calculates the length of city names that start with 'm' or 'M'. <br> <br> <h3>Example Cities</h3> <ul> <li>Mumbai <li>Munnar <li>Chennai <li
src/test/java/com/github/streams/practice/b_medium_problems/strings/C_LengthOfCityTest.java:23
ClassC_SumOfDigits
Calculates the sum of digits of a given integer. <p>This method takes an integer as input, breaks it down into individual digits, and returns their s
src/test/java/com/github/streams/practice/b_medium_problems/numbers/C_SumOfDigits.java:19
ClassC_SumOfSalaryInEachDept
src/test/java/com/github/streams/practice/b_medium_problems/employee/C_SumOfSalaryInEachDept.java:26
ClassC_UniqueEmailAddresses
Imagine you’re building a registration system for a website. Sometimes, due to user error or system retries, duplicate emails get stored in your list.
src/test/java/com/github/streams/practice/a_easy_problems/numbers/C_UniqueEmailAddresses.java:18
ClassD_NumberOfEmployeeInEachDept
src/test/java/com/github/streams/practice/b_medium_problems/employee/D_NumberOfEmployeeInEachDept.java:28
ClassD_NumberOfOccurencesOfEachCharacterTest
Count the number of occurrences of each character in a string (spaces excluded). <p>Example: <br> Input: "the quick brown fox jumps right over the li
src/test/java/com/github/streams/practice/a_easy_problems/strings/D_NumberOfOccurencesOfEachCharacterTest.java:17
ClassD_NumberOfOccurencesOfEachCharacterTest
src/test/java/com/github/streams/practice/b_medium_problems/strings/D_NumberOfOccurencesOfEachCharacterTest.java:9
ClassD_SimpleStreams
This set of exercises covers simple stream pipelines, including intermediate operations and basic collectors. <p>Some of these exercises use a Buffer
src/test/java/com/github/streams/practice/functional_interfaces/solutions/D_SimpleStreams.java:21
ClassD_SupplierTest
src/test/java/com/github/streams/practice/functional_interfaces/D_SupplierTest.java:9
ClassD_ValidNumbersOnly
Extracts integers from a list of strings. <br> <br> Example:<br> Input: ["as", "123", "32", "2as"]<br> Output: [123, 32]<br> Explanation: Parses strin
src/test/java/com/github/streams/practice/a_easy_problems/numbers/D_ValidNumbersOnly.java:16
ClassD_ValidNumbersOnly
Extracts integers from a list of strings. <br> <br> Example:<br> Input: ["as", "123", "32", "2as"]<br> Output: [123, 32]<br> Explanation: Parses strin
src/test/java/com/github/streams/practice/b_medium_problems/numbers/D_ValidNumbersOnly.java:16
EnumDepartment
src/test/java/com/github/streams/practice/b_medium_problems/employee/ignore/domain_related/Department.java:3
InterfaceDoubleToIntBiFunction
src/test/java/com/github/streams/practice/functional_interfaces/F_ComparatorTest.java:231
InterfaceDoubleToIntBiFunction
src/test/java/com/github/streams/practice/functional_interfaces/solutions/B_Comparators.java:260
ClassDummyData
src/test/java/com/github/streams/practice/a_easy_problems/numbers/data/DummyData.java:9
ClassDummyData
src/test/java/com/github/streams/practice/b_medium_problems/numbers/data/DummyData.java:9
ClassDummyEmployees
src/test/java/com/github/streams/practice/b_medium_problems/employee/ignore/domain_related/dummy_data/DummyEmployees.java:16
ClassDummyProjects
src/test/java/com/github/streams/practice/b_medium_problems/employee/ignore/domain_related/dummy_data/DummyProjects.java:8
ClassE_BiFunctionTest
src/test/java/com/github/streams/practice/functional_interfaces/E_BiFunctionTest.java:9
ClassE_EmployeesBelongToEachDept
src/test/java/com/github/streams/practice/b_medium_problems/employee/E_EmployeesBelongToEachDept.java:35
ClassE_IntermediateStreams
This set of exercises covers more advanced stream operations longer stream pipelines, and simple reductions.
src/test/java/com/github/streams/practice/functional_interfaces/solutions/E_IntermediateStreams.java:27
ClassE_NumberOfOccurencesOfEachWordTest
Count the number of occurrences of each word in a string. <p>Example: <br> Input: "the quick brown fox jumps right over the little lazy dog little" <
src/test/java/com/github/streams/practice/a_easy_problems/strings/E_NumberOfOccurencesOfEachWordTest.java:17
ClassE_NumberOfOccurencesOfEachWordTest
src/test/java/com/github/streams/practice/b_medium_problems/strings/E_NumberOfOccurencesOfEachWordTest.java:9
ClassE_RemoveDuplicates
Removes duplicates from a list of integers. <p><b>Input:</b> [1, 2, 2, 3, 4, 4, 5] <br> <b>Output:</b> [1, 2, 3, 4, 5] <br> <p><b>Explanation:</b> R
src/test/java/com/github/streams/practice/a_easy_problems/numbers/E_RemoveDuplicates.java:17
ClassEasyNumbersProblemSolution
src/test/java/com/github/streams/practice/a_easy_problems/numbers/EasyNumbersProblemSolution.java:7
ClassEmployee
src/test/java/com/github/streams/practice/b_medium_problems/employee/ignore/domain_related/Employee.java:5
ClassF_AdvancedStreams
This set of exercises covers advanced stream operations, including grouping collectors, composition of collectors, and customized collectors.
src/test/java/com/github/streams/practice/functional_interfaces/solutions/F_AdvancedStreams.java:27
ClassF_AscendingNumberValue
Re-arranges the elements of a numeric array to form the smallest possible value. <p>Example: Input: [1, 34, 3, 98, 9, 76, 45, 4] <br> Output: 1334445
src/test/java/com/github/streams/practice/a_easy_problems/numbers/F_AscendingNumberValue.java:17
ClassF_AscendingNumberValue
Re-arranges the elements of a numeric array to form the smallest possible value. <p>Example: Input: [1, 34, 3, 98, 9, 76, 45, 4] <br> Output: 1334445
src/test/java/com/github/streams/practice/b_medium_problems/numbers/F_AscendingNumberValue.java:17
ClassF_ComparatorTest
src/test/java/com/github/streams/practice/functional_interfaces/F_ComparatorTest.java:11
ClassF_ConcatenationOfStrings
Given a list of strings, concatenate all strings separated by a comma using Java Streams. <p>Example: <br> Input: ["Hellow", "World", "Hello", "World
src/test/java/com/github/streams/practice/a_easy_problems/strings/F_ConcatenationOfStrings.java:15
ClassF_ConcatenationOfStrings
src/test/java/com/github/streams/practice/b_medium_problems/strings/F_ConcatenationOfStrings.java:8
ClassF_ManagerWithMaxEmployees
src/test/java/com/github/streams/practice/b_medium_problems/employee/F_ManagerWithMaxEmployees.java:9
ClassG_DescendingNumberValue
Re-arranges the elements of a numeric array to form the highest possible value. <p>Example: <br> Input: [1, 34, 3, 98, 9, 76, 45, 4] <br> Output: "99
src/test/java/com/github/streams/practice/a_easy_problems/numbers/G_DescendingNumberValue.java:16
ClassG_DescendingNumberValue
src/test/java/com/github/streams/practice/b_medium_problems/numbers/G_DescendingNumberValue.java:14
ClassG_EmployeesWhoWorkedOnMostProject
src/test/java/com/github/streams/practice/b_medium_problems/employee/G_EmployeesWhoWorkedOnMostProject.java:48
ClassG_RemoveDuplicateCharactersTest
Remove duplicate characters from a string, preserving the order of first occurrence. <p>Example: <br> Input: "dabfcadef" <br> Output: "dabfce" <br> E
src/test/java/com/github/streams/practice/a_easy_problems/strings/G_RemoveDuplicateCharactersTest.java:16
ClassG_RemoveDuplicateCharactersTest
src/test/java/com/github/streams/practice/b_medium_problems/strings/G_RemoveDuplicateCharactersTest.java:8
ClassG_RunnableTest
src/test/java/com/github/streams/practice/functional_interfaces/G_RunnableTest.java:8
ClassH_ReverseANumber
Reverse the digits of an integer. <p>Example: <br> Input: 12345 <br> Output: 54321
src/test/java/com/github/streams/practice/a_easy_problems/numbers/H_ReverseANumber.java:15
ClassH_ReverseANumber
Reverses the digits of a given integer. <p>Example:<br> Input: 1234<br> Output: 4321
src/test/java/com/github/streams/practice/b_medium_problems/numbers/H_ReverseANumber.java:15
ClassH_ReverseStringWithSpecialCharactersTest
Reverse a string that may contain special characters and Unicode (e.g., emojis). <p>Example: <br> Input: "Hello world! This is a test. 😅" <br> Output
src/test/java/com/github/streams/practice/a_easy_problems/strings/H_ReverseStringWithSpecialCharactersTest.java:14
ClassH_ReverseStringWithSpecialCharactersTest
Unit test for reversing a string that contains special characters. <p>This test class is designed to verify the correctness of a method that reverses
src/test/java/com/github/streams/practice/b_medium_problems/strings/H_ReverseStringWithSpecialCharactersTest.java:15
ClassHardNumbersProblemSolution
src/test/java/com/github/streams/practice/c_hard_problems/numbers/HardNumbersProblemSolution.java:11
ClassI_SecondHighestWordTest
Find the second-largest word (by character length) in a given string. <p>Example: <br> Input: "I am interested123455 to grow in my organization" <br>
src/test/java/com/github/streams/practice/a_easy_problems/strings/I_SecondHighestWordTest.java:16
ClassI_SecondHighestWordTest
src/test/java/com/github/streams/practice/b_medium_problems/strings/I_SecondHighestWordTest.java:8
ClassI_SegregateEvenOddNumbers
Divides a list of integers into two separate lists, one containing all even numbers and the other containing all odd numbers. Input: {1, 2, 3, 4, 5, 6
src/test/java/com/github/streams/practice/b_medium_problems/numbers/I_SegregateEvenOddNumbers.java:14
ClassIdentity
src/test/java/com/github/streams/practice/b_medium_problems/employee/ignore/domain_related/Identity.java:3
ClassJ_MeanOfNumbers
Calculate the mean (average) of a list of integers. <p>Example: <br> Input: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20] <
src/test/java/com/github/streams/practice/a_easy_problems/numbers/J_MeanOfNumbers.java:15
ClassJ_MeanOfNumbers
Calculates the arithmetic mean (average) of a list of integers. <p>Example:<br> Input: [1, 2, 3, 4, 5, ..., 20]<br> Output: 10.5
src/test/java/com/github/streams/practice/b_medium_problems/numbers/J_MeanOfNumbers.java:15
ClassJ_SortListBasedOn2ndCharacterTest
Sort a list of strings alphabetically by their second character. <p>Example: <br> Input: ["banana", "apple", "cherry", "date"] <br> Output: ["date",
src/test/java/com/github/streams/practice/a_easy_problems/strings/J_SortListBasedOn2ndCharacterTest.java:18
ClassJ_SortListBasedOn2ndCharacterTest
src/test/java/com/github/streams/practice/b_medium_problems/strings/J_SortListBasedOn2ndCharacterTest.java:10
ClassK_FindDuplicateStrings
Find all strings that appear more than once in a list. <p>Example: <br> Input: ["Hellow", "World", "How", "are", "you", "How", "are", "you"] <br> Out
src/test/java/com/github/streams/practice/a_easy_problems/strings/K_FindDuplicateStrings.java:16
ClassK_FindDuplicateStrings
src/test/java/com/github/streams/practice/b_medium_problems/strings/K_FindDuplicateStrings.java:8
ClassK_IntArray2DToListConverter
Convert a 2D integer array into a List of Lists of Integers using streams. <p>Example: <br> Input: {{1, 2, 3}, {4, 5, 6}, {7, 8, 9}} <br> Output: [[1
src/test/java/com/github/streams/practice/a_easy_problems/numbers/K_IntArray2DToListConverter.java:16
ClassK_IntArray2DToListConverter
Converts a 2D primitive int array into a {@code List<List<Integer>>}. <p>Example:<br> Input: {{1, 2}, {3, 4}, {5, 6}}<br> Output: [[1, 2], [3, 4], [5
src/test/java/com/github/streams/practice/b_medium_problems/numbers/K_IntArray2DToListConverter.java:16
ClassL_ConvertListOfCharactersToString
Convert a list of Character objects into a single concatenated String. <p>Example: <br> Input: ['A', 'B', 'C', 'D', ..., 'Z'] <br> Output: "ABCDEFGHI
src/test/java/com/github/streams/practice/a_easy_problems/strings/L_ConvertListOfCharactersToString.java:15
ClassL_ConvertListOfCharactersToString
src/test/java/com/github/streams/practice/b_medium_problems/strings/L_ConvertListOfCharactersToString.java:8
ClassL_GenerateInfinitePrimeNumberStream
Generates a list of the first N prime numbers using an infinite stream. <p>Example:<br> Input: N = 5<br> Output: [2, 3, 5, 7, 11]
src/test/java/com/github/streams/practice/b_medium_problems/numbers/L_GenerateInfinitePrimeNumberStream.java:15
ClassM_UpperCaseOddLengthWords
Given a list of words, filter out only the words with an odd character length and convert them to uppercase. <p>Example: <br> Input: ["alfa", "bravo"
src/test/java/com/github/streams/practice/a_easy_problems/strings/M_UpperCaseOddLengthWords.java:17
ClassM_UpperCaseOddLengthWords
src/test/java/com/github/streams/practice/b_medium_problems/strings/M_UpperCaseOddLengthWords.java:8
ClassMediumNumbersProblemSolution
src/test/java/com/github/streams/practice/b_medium_problems/numbers/MediumNumbersProblemSolution.java:10
ClassMediumStringProblemsSolution
Reference solutions for medium-tier string problems. <p>The 12 methods below are identical to {@link com.github.streams.practice.a_easy_problems.stri
src/test/java/com/github/streams/practice/b_medium_problems/strings/MediumStringProblemsSolution.java:18
ClassN_FirstNonRepeatingCharacterTest
Find the first character in a string that does not repeat anywhere else in the string. (Classic Google interview question) <p>Example: <br> Input: "T
src/test/java/com/github/streams/practice/a_easy_problems/strings/N_FirstNonRepeatingCharacterTest.java:17
ClassN_FirstNonRepeatingCharacterTest
Given a String find the first non-repeating character: <p>String = The quick brown fox jumps over the lazy dog, find the first non-repeated character
src/test/java/com/github/streams/practice/b_medium_problems/strings/N_FirstNonRepeatingCharacterTest.java:14
ClassN_GroupingOfNumbersTest
src/test/java/com/github/streams/practice/a_easy_problems/numbers/N_GroupingOfNumbersTest.java:31
ClassN_GroupingOfNumbersTest
src/test/java/com/github/streams/practice/b_medium_problems/numbers/N_GroupingOfNumbersTest.java:31
ClassO_UniqueEmailCount
Given a list of employees, each with an email address, extract all unique email domains and count how many employees use each domain. <p>Example: <br
src/test/java/com/github/streams/practice/a_easy_problems/strings/O_UniqueEmailCount.java:21
ClassO_UniqueEmailCount
src/test/java/com/github/streams/practice/b_medium_problems/strings/O_UniqueEmailCount.java:17
ClassP_WordWithMaxNumberOfVowelsTest
Given a string, find the highest number of vowels present in any single word. <p>Example: <br> Input: "HELLO HOW ARE YOU" <br> Output: 2 <br> Explana
src/test/java/com/github/streams/practice/a_easy_problems/strings/P_WordWithMaxNumberOfVowelsTest.java:17
ClassP_WordWithMaxNumberOfVowelsTest
Given A String Find the highest number of vowels present in a word. <p>Example: INPUT: HELLO HOW ARE YOU OUTPUT: 2 EXPLANATION: HELLO contains 2 vowe
src/test/java/com/github/streams/practice/b_medium_problems/strings/P_WordWithMaxNumberOfVowelsTest.java:14
ClassPerson
src/test/java/com/github/streams/practice/functional_interfaces/F_ComparatorTest.java:13
ClassPerson
src/test/java/com/github/streams/practice/functional_interfaces/solutions/B_Comparators.java:17
ClassProblemSolutions
src/test/java/com/github/streams/practice/b_medium_problems/ProblemSolutions.java:10
ClassProject
src/test/java/com/github/streams/practice/b_medium_problems/employee/ignore/domain_related/Project.java:3
ClassQ_FrequentVowelPlusConstant
src/test/java/com/github/streams/practice/b_medium_problems/strings/Q_FrequentVowelPlusConstant.java:58
ClassScanTest
src/test/java/com/github/streams/practice/gatherers/ScanTest.java:12
ClassStringProblemsSolution
src/test/java/com/github/streams/practice/a_easy_problems/strings/StringProblemsSolution.java:7
ClassTotalAndDistinct
Count the total number of words and the number of distinct, lower case words in a stream, in one pass. This exercise uses a helper class that defines
src/test/java/com/github/streams/practice/functional_interfaces/solutions/F_AdvancedStreams.java:343
ClassWindowFixedTest
src/test/java/com/github/streams/practice/gatherers/WindowFixedTest.java:17