Tag: collect
-
How to check whether a given number is ArmStrong number or not?
This is the complete solution to check whether a given number is ArmStrong number or not. This solution is designed to solve the problem using an interface, super class and three derived classes implementing the interface.
-
How to find the factorial of a given number?
This is the complete solution to find the factorial of a given number. This solution is designed to solve the problem using an interface, super class and three derived classes implementing the interface.
-
How to find array triplets with sum of two elements equals other element in the same array using stream
This is the third solution to find array triplets, with sum of any two numbers equals with any other element in the same array. This approach uses IntStream, flatMap, filter, mapToObj of Stream.
-
How to find the triplet numbers from an array whose sum is divisible by 9 using stream
This is the third solution to find the triplets of numbers in which their sum is divisible by 9 from an array of integers. This method uses three nested IntStream to traverse array, add any three numbers come across in each iteration, and then uses simple predicate to verify that the sum is divisible by…
-
How to find the pairs of numbers from an array whose sum is divisible by 9 using stream
This is the third solution to find the pairs of numbers in which their sum is divisible by 9 from an array of integers. This method uses nested IntStreams to traverse the array , add any two numbers come across in each iteration, and then uses a simple predicate to verify that the sum is…
-
How to find Nth largest number in an array list using streams
This is the fourth solution to find the Nth largest number from an array list of given integers or doubles or strings. This program uses the sorted(), and collectors() methods of stream.
-
How to reverse each word in a given sentence
This is the fourth solution to reverse each word of given line of strings. This program uses the map() method of java stream, and reverse() method of StringBuffer.
