Tag: Predicate
-
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 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 check whether a string is a palindrome
This is the second solution to check whether a given string is palindrome or not. This approach uses a simple predicate with lambda expression, and uses String class methods.
-
How to check whether a string is a palindrome
This is the first solution to check whether a given string is palindrome or not. This approach uses a simple predicate with lambda expression, and uses StringBuffer class method.
-
How to extract characters and numbers from an Alphanumeric value
This is the third solution to extract characters and numbers from an alpha numeric value into separate strings. This program uses the simple predicate and predicates chaining to check for characters and numbers.
