MCPcopy Create free account

hub / github.com/ZahidFKhan/Streams-API-Practices / functions

Functions256 in github.com/ZahidFKhan/Streams-API-Practices

Methodc08_mapWithMissingValues
For some reason the provided map doesn't have mappings for all the keys. This is a problem, because if we call get() on a key that isn't present, it r
src/test/java/com/github/streams/practice/functional_interfaces/solutions/C_DefaultMethodsTest.java:229
Methodc09_mapRemoveEntriesWithEmptyValues
In the previous example, we added map entries that had a default value. We've now determined that's incorrect, and we want to undo that. This time, we
src/test/java/com/github/streams/practice/functional_interfaces/solutions/C_DefaultMethodsTest.java:255
Methodc10_mapReplaceEmptyValues
We need another way to deal with the problem of the previous example. Instead of removing entries whose value is the empty string, we want to replace
src/test/java/com/github/streams/practice/functional_interfaces/solutions/C_DefaultMethodsTest.java:282
Methodc11_computeWithMissingEntries
We are still dealing with a map with missing entries. For entries that are present, we want to convert the value to upper case; and for keys that are
src/test/java/com/github/streams/practice/functional_interfaces/solutions/C_DefaultMethodsTest.java:312
Methodc12_computeAndRemoveSomeEntries
The map now has several entries, some with valid values, and some with values that are the empty string. This time, we want to convert the non-empty v
src/test/java/com/github/streams/practice/functional_interfaces/solutions/C_DefaultMethodsTest.java:340
Methodc_consumer1
Write a lambda expression that appends the string "abc" to the given StringBuilder.
src/test/java/com/github/streams/practice/functional_interfaces/C_ConsumerTest.java:14
Methodc_consumer1
Write a lambda expression that appends the string "abc" to the given StringBuilder.
src/test/java/com/github/streams/practice/functional_interfaces/solutions/A_Lambdas.java:182
Methodc_consumer2
Write a lambda expression that clears the given list.
src/test/java/com/github/streams/practice/functional_interfaces/C_ConsumerTest.java:26
Methodc_consumer2
Write a lambda expression that clears the given list.
src/test/java/com/github/streams/practice/functional_interfaces/solutions/A_Lambdas.java:195
Methodc_consumer3
Write an unbound method reference that clears the given list.
src/test/java/com/github/streams/practice/functional_interfaces/C_ConsumerTest.java:37
Methodc_consumer3
Write an unbound method reference that clears the given list.
src/test/java/com/github/streams/practice/functional_interfaces/solutions/A_Lambdas.java:208
Methodc_consumer4
Given two consumers, create a consumer that passes the String to the first consumer, then to the second.
src/test/java/com/github/streams/practice/functional_interfaces/C_ConsumerTest.java:51
Methodc_consumer4
Given two consumers, create a consumer that passes the String to the first consumer, then to the second.
src/test/java/com/github/streams/practice/functional_interfaces/solutions/A_Lambdas.java:224
Methodcombine
(TotalAndDistinct other)
src/test/java/com/github/streams/practice/functional_interfaces/solutions/F_AdvancedStreams.java:357
Methodcomparator01
Write a Comparator that compare instances of String using their length. For instance FOUR (4 letters) is greater than TWO (three letters)
src/test/java/com/github/streams/practice/functional_interfaces/F_ComparatorTest.java:25
Methodcomparator01
Write a Comparator that compare instances of String using their length. For instance FOUR (4 letters) is greater than TWO (three letters)
src/test/java/com/github/streams/practice/functional_interfaces/solutions/B_Comparators.java:29
Methodcomparator02
Write a Comparator that compare instances of String using their length. If the lengths are the same, then use the alphabetical order.
src/test/java/com/github/streams/practice/functional_interfaces/F_ComparatorTest.java:46
Methodcomparator02
Write a Comparator that compare instances of String using their length. If the lengths are the same, then use the alphabetical order.
src/test/java/com/github/streams/practice/functional_interfaces/solutions/B_Comparators.java:52
Methodcomparator03
Write a Comparator that compares instances of Person using their lastName.
src/test/java/com/github/streams/practice/functional_interfaces/F_ComparatorTest.java:67
Methodcomparator03
Write a Comparator that compares instances of Person using their lastName.
src/test/java/com/github/streams/practice/functional_interfaces/solutions/B_Comparators.java:76
Methodcomparator04
Write a Comparator that compares instances of Person using their lastName, and if their last projectName is the same, uses their first projectName.
src/test/java/com/github/streams/practice/functional_interfaces/F_ComparatorTest.java:88
Methodcomparator04
Write a Comparator that compares instances of Person using their lastName, and if their last projectName is the same, uses their first projectName.
src/test/java/com/github/streams/practice/functional_interfaces/solutions/B_Comparators.java:99
Methodcomparator05
Write a Comparator that compares the people in the order reversed from the one you wrote in the comparator04() exercise. That is, the person with the
src/test/java/com/github/streams/practice/functional_interfaces/F_ComparatorTest.java:109
Methodcomparator05
Write a Comparator that compares the people in the order reversed from the one you wrote in the comparator04() exercise. That is, the person with the
src/test/java/com/github/streams/practice/functional_interfaces/solutions/B_Comparators.java:123
Methodcomparator06
Write a Comparator that compares the people in the same order than the one you wrote in comparator04(), but that supports null values. The null values
src/test/java/com/github/streams/practice/functional_interfaces/F_ComparatorTest.java:129
Methodcomparator06
Write a Comparator that compares the people in the same order than the one you wrote in comparator04(), but that supports null values. The null values
src/test/java/com/github/streams/practice/functional_interfaces/solutions/B_Comparators.java:146
Methodcomparator07
Write a Comparator that compares two people by age. Try to write the comparator so as to avoid boxing of primitives.
src/test/java/com/github/streams/practice/functional_interfaces/F_ComparatorTest.java:150
Methodcomparator07
Write a Comparator that compares two people by age. Try to write the comparator so as to avoid boxing of primitives.
src/test/java/com/github/streams/practice/functional_interfaces/solutions/B_Comparators.java:170
Methodcomparator08
Write a lambda expression that compares two int values and returns an int result that is less than, equal to, or greater than zero, like a comparator.
src/test/java/com/github/streams/practice/functional_interfaces/F_ComparatorTest.java:172
Methodcomparator08
Write a lambda expression that compares two int values and returns an int result that is less than, equal to, or greater than zero, like a comparator.
src/test/java/com/github/streams/practice/functional_interfaces/solutions/B_Comparators.java:194
Methodcomparator09
Write a method reference that compares two int values and returns an int result that is less than, equal to, or greater than zero, like a comparator.
src/test/java/com/github/streams/practice/functional_interfaces/F_ComparatorTest.java:193
Methodcomparator09
Write a method reference that compares two int values and returns an int result that is less than, equal to, or greater than zero, like a comparator.
src/test/java/com/github/streams/practice/functional_interfaces/solutions/B_Comparators.java:219
Methodcomparator10
Write a method reference that compares two double values and returns an int result that is less than, equal to, or greater than zero, like a comparato
src/test/java/com/github/streams/practice/functional_interfaces/F_ComparatorTest.java:217
Methodcomparator10
Write a method reference that compares two double values and returns an int result that is less than, equal to, or greater than zero, like a comparato
src/test/java/com/github/streams/practice/functional_interfaces/solutions/B_Comparators.java:245
MethodconvertCelsiusToFahrenheit
()
src/test/java/com/github/streams/practice/a_easy_problems/numbers/B_MapCelsiusToFahrenheit.java:20
MethodconvertInt2DArrayToList
()
src/test/java/com/github/streams/practice/a_easy_problems/numbers/K_IntArray2DToListConverter.java:17
MethodconvertInt2DArrayToList
()
src/test/java/com/github/streams/practice/b_medium_problems/numbers/K_IntArray2DToListConverter.java:17
MethodconvertListOfCharactersToString
()
src/test/java/com/github/streams/practice/a_easy_problems/strings/L_ConvertListOfCharactersToString.java:16
MethodconvertListOfCharactersToString
()
src/test/java/com/github/streams/practice/b_medium_problems/strings/L_ConvertListOfCharactersToString.java:9
MethodcountEvenNumbers
()
src/test/java/com/github/streams/practice/a_easy_problems/numbers/A_CountEvenNumbers.java:18
MethodcountNumberOfEmployeeBelongToEachDept
()
src/test/java/com/github/streams/practice/b_medium_problems/employee/D_NumberOfEmployeeInEachDept.java:29
Methodd1_upcaseOddLengthWords
Given a list of words, create an output list that contains only the odd-length words, converted to upper case.
src/test/java/com/github/streams/practice/functional_interfaces/solutions/D_SimpleStreams.java:39
Methodd2_joinStreamRange
Take the third through fifth words of the list, extract the second letter from each, and join them, separated by commas, into a single string. Watch f
src/test/java/com/github/streams/practice/functional_interfaces/solutions/D_SimpleStreams.java:71
Methodd3_countLinesInFile
Count the number of lines in the text file. (Remember to use the BufferedReader named "reader" that has already been opened for you.) @throws IOExcep
src/test/java/com/github/streams/practice/functional_interfaces/solutions/D_SimpleStreams.java:103
Methodd4_findLengthOfLongestLine
Find the length of the longest line in the text file. @throws IOException
src/test/java/com/github/streams/practice/functional_interfaces/solutions/D_SimpleStreams.java:132
Methodd5_findLongestLine
Find the longest line in the text file. @throws IOException
src/test/java/com/github/streams/practice/functional_interfaces/solutions/D_SimpleStreams.java:156
Methodd6_selectLongestWords
Select the longest words from the input list. That is, select the words whose lengths are equal to the maximum word length.
src/test/java/com/github/streams/practice/functional_interfaces/solutions/D_SimpleStreams.java:179
Methodd7_selectByLengthAndPosition
Select the list of words from the input list whose length is greater than the word's position in the list (starting from zero) .
src/test/java/com/github/streams/practice/functional_interfaces/solutions/D_SimpleStreams.java:210
Methodd_supplier1
Write a lambda expression that returns a new StringBuilder containing the string "abc".
src/test/java/com/github/streams/practice/functional_interfaces/D_SupplierTest.java:11
Methodd_supplier1
Write a lambda expression that returns a new StringBuilder containing the string "abc".
src/test/java/com/github/streams/practice/functional_interfaces/solutions/A_Lambdas.java:245
Methodd_supplier2
Write a lambda expression that returns a new, empty StringBuilder.
src/test/java/com/github/streams/practice/functional_interfaces/D_SupplierTest.java:20
Methodd_supplier2
Write a lambda expression that returns a new, empty StringBuilder.
src/test/java/com/github/streams/practice/functional_interfaces/solutions/A_Lambdas.java:256
Methodd_supplier3
Write a constructor reference that returns a new, empty StringBuilder.
src/test/java/com/github/streams/practice/functional_interfaces/D_SupplierTest.java:29
Methodd_supplier3
Write a constructor reference that returns a new, empty StringBuilder.
src/test/java/com/github/streams/practice/functional_interfaces/solutions/A_Lambdas.java:267
Methode1_stringsToCharacters
Convert a list of strings into a list of characters.
src/test/java/com/github/streams/practice/functional_interfaces/solutions/E_IntermediateStreams.java:48
Methode2_listOfAllWords
Collect all the words from the text file into a list. Use the regular expression Pattern SPLIT_PATTERN to split a string into words, and use Pattern.s
src/test/java/com/github/streams/practice/functional_interfaces/solutions/E_IntermediateStreams.java:77
Methode3_longLowerCaseSortedWords
Read the words from the text file, and create a list containing the words of length 8 or longer, converted to lower case, and sorted alphabetically.
src/test/java/com/github/streams/practice/functional_interfaces/solutions/E_IntermediateStreams.java:212
Methode4_longLowerCaseReverseSortedWords
Read the words from the text file, and create a list containing the words of length 8 or longer, converted to lower case, and sorted reverse alphabeti
src/test/java/com/github/streams/practice/functional_interfaces/solutions/E_IntermediateStreams.java:255
Methode5_sortedLowerCaseDistinctByLengthThenAlphabetically
Read words from the text file, and sort unique, lower-cased words by length, then alphabetically within length, and place the result into an output li
src/test/java/com/github/streams/practice/functional_interfaces/solutions/E_IntermediateStreams.java:299
Methode6_bigFactorial
Compute the value of 21!, that is, 21 factorial. This value is larger than Long.MAX_VALUE, so you must use BigInteger.
src/test/java/com/github/streams/practice/functional_interfaces/solutions/E_IntermediateStreams.java:409
Methode7_getLastWord
Get the last word in the text file. @throws IOException
src/test/java/com/github/streams/practice/functional_interfaces/solutions/E_IntermediateStreams.java:435
Methode8_selectTheSuperClassesOfArrayList
Create a list containing ArrayList.class and all its super classes.
src/test/java/com/github/streams/practice/functional_interfaces/solutions/E_IntermediateStreams.java:461
Methode9_countTheElementsAfterAPredicate
Count the length of a stream dropping the first elements on a predicate.
src/test/java/com/github/streams/practice/functional_interfaces/solutions/E_IntermediateStreams.java:479
Methode_bifunction1
Write a lambda expression that, given two strings, returns the result of concatenating the first with the second, followed by the first again.
src/test/java/com/github/streams/practice/functional_interfaces/E_BiFunctionTest.java:14
Methode_bifunction1
Write a lambda expression that, given two strings, returns the result of concatenating the first with the second, followed by the first again.
src/test/java/com/github/streams/practice/functional_interfaces/solutions/A_Lambdas.java:281
Methode_bifunction2
Write a lambda expression that returns the index of the first occurrence of the second string within the first string, or -1 if the second string does
src/test/java/com/github/streams/practice/functional_interfaces/E_BiFunctionTest.java:26
Methode_bifunction2
Write a lambda expression that returns the index of the first occurrence of the second string within the first string, or -1 if the second string does
src/test/java/com/github/streams/practice/functional_interfaces/solutions/A_Lambdas.java:295
Methode_bifunction3
Write an unbound method reference that returns the index of the first occurrence of the second string within the first string, or -1 if the second str
src/test/java/com/github/streams/practice/functional_interfaces/E_BiFunctionTest.java:49
Methode_bifunction3
Write an unbound method reference that returns the index of the first occurrence of the second string within the first string, or -1 if the second str
src/test/java/com/github/streams/practice/functional_interfaces/solutions/A_Lambdas.java:320
MethodemployeeWorkedOnMostProject
()
src/test/java/com/github/streams/practice/b_medium_problems/employee/G_EmployeesWhoWorkedOnMostProject.java:64
MethodemployeesBelongToEachDept
()
src/test/java/com/github/streams/practice/b_medium_problems/employee/E_EmployeesBelongToEachDept.java:36
Methodf1_mapLengthToWordList
Categorize the words from the text file into a map, where the map's key is the length of each word, and the value corresponding to a key is a list of
src/test/java/com/github/streams/practice/functional_interfaces/solutions/F_AdvancedStreams.java:57
Methodf2_mapLengthToWordCount
Categorize the words from the text file into a map, where the map's key is the length of each word, and the value corresponding to a key is a count of
src/test/java/com/github/streams/practice/functional_interfaces/solutions/F_AdvancedStreams.java:96
Methodf3_wordFrequencies
Gather the words from the text file into a map, accumulating a count of the number of occurrences of each word. Don't worry about upper case and lower
src/test/java/com/github/streams/practice/functional_interfaces/solutions/F_AdvancedStreams.java:140
Methodf4_nestedMaps
From the words in the text file, create nested maps, where the outer map is a map from the first letter of the word to an inner map. (Use a string of
src/test/java/com/github/streams/practice/functional_interfaces/solutions/F_AdvancedStreams.java:192
Methodf5_separateOddEvenSums
Given a stream of integers, compute separate sums of the even and odd values in this stream. Since the input is a stream, this necessitates making a s
src/test/java/com/github/streams/practice/functional_interfaces/solutions/F_AdvancedStreams.java:239
Methodf6_insertBeginningAndEnd
Given a stream of strings, accumulate (collect) them into the result string by inserting the input string at both the beginning and end. For example,
src/test/java/com/github/streams/practice/functional_interfaces/solutions/F_AdvancedStreams.java:271
Methodf7_countTotalAndDistinctWords
()
src/test/java/com/github/streams/practice/functional_interfaces/solutions/F_AdvancedStreams.java:304
Methodf_runnable1
Write a lambda expression that appends the 'suffix' variable (a String) to the sb variable (a StringBuilder).
src/test/java/com/github/streams/practice/functional_interfaces/G_RunnableTest.java:14
Methodf_runnable1
Write a lambda expression that appends the 'suffix' variable (a String) to the sb variable (a StringBuilder).
src/test/java/com/github/streams/practice/functional_interfaces/solutions/A_Lambdas.java:348
MethodfakeListOfLongNumbers
()
src/test/java/com/github/streams/practice/b_medium_problems/numbers/data/DummyData.java:18
Methodfind2ndHighestWord
()
src/test/java/com/github/streams/practice/a_easy_problems/strings/I_SecondHighestWordTest.java:17
Methodfind2ndHighestWord
()
src/test/java/com/github/streams/practice/b_medium_problems/strings/I_SecondHighestWordTest.java:9
MethodfindDuplicateStrings
()
src/test/java/com/github/streams/practice/a_easy_problems/strings/K_FindDuplicateStrings.java:17
MethodfindDuplicateStrings
()
src/test/java/com/github/streams/practice/b_medium_problems/strings/K_FindDuplicateStrings.java:9
MethodfindLargestWordInTheString
Find the largest word in a given string. <br> <br> Example string: <pre> Input: "I am interested123455 to grow in my organization" Output: "intereste
src/test/java/com/github/streams/practice/a_easy_problems/strings/B_LargestWordTest.java:21
MethodfindLargestWordInTheString
Find the largest word in a given string. <br> <br> Example string: <pre> Input: "I am interested123455 to grow in my organization" Output: "intereste
src/test/java/com/github/streams/practice/b_medium_problems/strings/B_LargestWordTest.java:21
MethodfindManagerWithMaxEmployeesTest
()
src/test/java/com/github/streams/practice/b_medium_problems/employee/F_ManagerWithMaxEmployees.java:32
MethodfindUniqueDomainsWithCount
()
src/test/java/com/github/streams/practice/a_easy_problems/strings/O_UniqueEmailCount.java:22
MethodfindUniqueDomainsWithCount
()
src/test/java/com/github/streams/practice/b_medium_problems/strings/O_UniqueEmailCount.java:18
MethodfreqVowelsPlusConstant
()
src/test/java/com/github/streams/practice/b_medium_problems/strings/Q_FrequentVowelPlusConstant.java:60
Methodfunction1
Write a lambda expression that wraps the given string in parentheses.
src/test/java/com/github/streams/practice/functional_interfaces/B_FunctionTest.java:11
Methodfunction2
Write a lambda expression that converts the given string to upper case.
src/test/java/com/github/streams/practice/functional_interfaces/B_FunctionTest.java:21
Methodfunction3
Write an unbound method reference that converts the given string to upper case.
src/test/java/com/github/streams/practice/functional_interfaces/B_FunctionTest.java:30
Methodfunction4
Given two Functions, one that converts a null reference to an empty string, and another that gets the length of a string, create a single function con
src/test/java/com/github/streams/practice/functional_interfaces/B_FunctionTest.java:43
Methodg_boundMethodRef1
Write a lambda expression that takes a string argument and returns the index of that argument into the string "abcdefghij", or that returns -1 if the
src/test/java/com/github/streams/practice/functional_interfaces/B_FunctionTest.java:60
Methodg_boundMethodRef1
Write a lambda expression that takes a string argument and returns the index of that argument into the string "abcdefghij", or that returns -1 if the
src/test/java/com/github/streams/practice/functional_interfaces/solutions/A_Lambdas.java:368
Methodg_boundMethodRef2
Write a bound method reference that takes a string argument and returns the index of that argument into the string "abcdefghij", or that returns -1 if
src/test/java/com/github/streams/practice/functional_interfaces/B_FunctionTest.java:86
Methodg_boundMethodRef2
Write a bound method reference that takes a string argument and returns the index of that argument into the string "abcdefghij", or that returns -1 if
src/test/java/com/github/streams/practice/functional_interfaces/solutions/A_Lambdas.java:396
MethodgetUniqueNumberFromList
(List<T> input)
src/test/java/com/github/streams/practice/b_medium_problems/numbers/MediumNumbersProblemSolution.java:36
← previousnext →101–200 of 256, ranked by callers