Home > Java Core

Java Core

How to check if any word from a List exists in a String in Java8

Java

In this article, we will learn how to check if any word from a list of keywords exists in a String using Java 8 stream API. We have an input string and a list of words, we will check if any of the words from the list exists in the input string or not. And we also have a list ... Read More »

How to search a List of words in a String in Java8

Java

In this article, we will learn how to search a list of keywords/strings in a String/ Text using Java 8 stream API. We have an input string, in which we want to search a list of keywords – And we also have a list of keywords listed below – Now below code using Java8 will search for all the keywords ... Read More »

AES Encryption Class Compatible with Java and PHP

Java

Most of the time we come across a scenario where we want something that is encrypted in Java, that requires to be decrypted by PHP or vice versa. In this article, we will build a Java class that encrypt-decrypt the input string and the same class in PHP which also encrypt-decrypts the input string and produces the same result. AES ... Read More »

Check if IP is in CIDR Range

Java

Java class to find if the given IP is in range of CIDR provided, this utility will help in cases mostly like whitelisting the features in any application. Features like we have to restrict any endpoint from getting called outside of the given CIDR IP range. This is the core java library class, no other jar is required. CIDR (Classless ... Read More »

Convert CIDR notation to IP Range in Java

Java

What is CIDR? CIDR stands for – Classless Inter-Domain Routing (CIDR), also called supernetting. It is a way to allocate Internet Protocol (IP) addresses by creating unique and more granular identifiers for networks and devices. The objective of CIDR was to address scalability issues with classful IP addresses based on three classes –– Class A – capacity is 16,581,375 IP ... Read More »

Exceptional Handling in Lambda expressions- Functional Programming in JAVA 8- Part 6

Java

Before reading this post kindly go from part 1 of this post to understand lambda expression. https://jkoder.com/understanding-java-8-lambda-expression-functional-programming-in-java-8-part-1/ Lambda expressions are typically inline implementation of interfaces. It basically deals with the computation part, and we all know that in real world nothing is ideal. So, we may get exceptions in our code, and lambdas are no free from exceptions. So, in ... Read More »

Using built-in Function interfaces of java.util.function pacakge in JAVA 8- Functional Programming in JAVA 8- Part 5

Java

Before reading this post kindly go from part 4 of this post to understand lambda expression. https://jkoder.com/java-7-way-vs-java-8-way-lets-get-our-hands-dirty-with-lambdas-functional-programming-in-java-8-part-4/ Previously we saw JAVA 7 way & JAVA 8 way of doing things. One thing that we feel is extra is the interface. The Condition interface has a boolean method which took in Person object. You can also rename it to “Foo”, it ... Read More »