Tag: lambda expression
-
How to check whether a given integer is prime number or not ?
This is the complete solution to check whether a given integer number is prime or not. This solution is designed to to solve the problem using an interface, super class and four derived classes implementing the interface. The core logic is to check the divisibility of the given number, from 2 to till the square…
-
How to find Missing Prime numbers from any given sequence of integers using Stream
This is the second solution to find the missing prime numbers from any given sequence of integers. This solution uses the Lambda expression with single abstract method. The solution also uses the range, filter, foreach methods of IntStream.
-
How to find Missing Prime numbers from any given sequence of integers
This is the first solution to find the missing prime numbers from any given sequence of integers. This solution uses the Lambda expression with single abstract method. The solution is finding all the missing prime numbers between every pair for consecutive numbers from the given sequence till end. The logic for prime check is the…
-
How to reverse each word in a sentence using StringBuffer class
This is the third solution to reverse each word in the given input sentence. This program uses the Single Abstract method, which implemented by using Lambda expression.
-
How to find sum of digits in an integer value
This is the second solution to find the sum of digits of an integer value[s]. This solution defines a functional interface with single abstract method with lambda expression. The internal core logic converts an integer value to String, then parse each character to digit, and sums up each digit.
-
How to check whether a given integer is prime number or not
This is the third solution to check whether the given integer number is prime or not. This solution uses the Lambda expression with single abstract method. The implementation is to check the divisibility of the given number, from 2 to till the square root of the given number.
-
How to find intersection values of two Arrays
This is the third solution to find the intersection of two Arrays of integers. This program uses functional interface with single abstract method, and implementing by using lambda expression. The lambda expression accepts two arrays of integers data type. The internal logic is comparing each value of the first array with each of value of…
-
How to find Nth largest number in an array
This is the third solution to find the Nth largest number from an array of given integers or doubles or strings. This program defines one generic functional interface, with multiple Lambda expressions utilizes the same based on the data type. The internal logic utilizes the sort method of the Arrays class.
