Category: Java
-
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 intersection values of two Arrays
This is the second solution to find the intersection of two Arrays of integers or Strings or Characters. This program has one Generic method which accepts two arrays of any data type (Integers or Strings or Characters). The internal logic is comparing each value of the first array with each of value of the second…
-
How to find intersection values of two Arrays
This is the first solution to find the intersection of two Arrays of integers. This approach follows the core logic of comparing each of the first array with each of element of the second array. This program uses couple of StringBuilder’s class methods.
-
How to reverse all the data values in an Array
This is the second solution to reverse all the data values in an Array. This solution uses Java Generics, which defines a Generic method for reversing given Array data values. This solution modifies the same array, and the resultant array has all the data values reversed. The data values are of any type such as…
-
How to find reverse of an integer and string data value
This is the fourth solution to find the reverse of an integer or string data value by using the Generics. The internal logic of the Generic method uses the reverse method of StringBuffer class.
-
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.
-
How to find Nth largest number in an array
This is the second solution to find the Nth largest number from an array of given numbers. This program uses the Lambda expression, and the internal logic utilizes the sort method of the Arrays class.
-
How to find subsets of a given string
This is the third solution to list all the subsets or substrings of a given string. This approach uses functional interface with single abstract method implementation using lambda expression, the internal logic utilizes the String’s class substring method for intermediate processing of all sized sub strings.
