• Find duplicate elements in the Stream
    17 October

    Java 8 – Find duplicate elements in Stream

    Introduction When working with a collection of elements in Java, it is very common to have duplicate elements, and Java provides different APIs that we can use to solve the problem. Java 8 Stream provides the functionality to perform aggregate operations on a collection, and one of the operations includes finding duplicate elements. In this […]

  • 17 October

    Java AES 256 Encryption Decryption Example

    Introduction Advanced encryption standard (AES) is the most secure encryption standard compared to RSA, which is vulnerable to brute force attacks. This is the main reason that AES was established by the National Institute of Standard and Technology (NIST) in 2001 and is used worldwide to date. In the previous post, we have seen how […]

  • Get current year in java
    13 July

    Get current year in Java

    In this post, we will see how to get current year in Java. Using Date and SimpleDateFormat The Date class was introduced in Java 1.0 and provided different approaches to work with time. The SimpleDateFormat inherits from DateFormat and is mainly used to parse a date to text. You can provide your custom pattern to […]

  • 13 July

    Remove substring from String in Java

    In this post, we will see how to remove substring from String in java. There are multiple ways to remove substring from String in java. Using String’s replace method to remove substring from String in Java This method belongs to the Java String class and is overloaded to provide two different implementations of the same […]

  • Break out of nested loop in java
    22 July

    How to break out of nested loops in Java

    In this post, we will see how to break out of nested loops in Java. Using break (will break inner loop) It is very important to understand how nested loops work to ensure that applying break will output the desired result. If you are a novice with nested loops, I am going to make the […]

  • Print LinkedList in java
    26 June

    Print LinkedList in java

    Java inbuilt LinkedList Java inbuilt LinkedList class uses doubly linked list as internal data structure to store its elements. It is subclass of AbstractList and implements List and Deque interfaces. Insertion and deletion of elements is faster than ArrayList as it interally uses double LinkedList. Print LinkedList using a for loop The most common method […]

  • Print HashMap in java
    30 June

    Print HashMap in Java

    In this article, we will see how to print HashMap in java using different method. Print from the HashMap Reference This is the most basic and easiest method to print out HashMap in java. Pass the HashMap reference to the System.out.println, and the HashMap will output the key-value of the elements enclosed in curly brackets. […]

  • Java String contains IgnoreCase
    23 June

    Java String contains Ignore Case

    We often have to check if a string contains a substring or not in a case-insensitive manner. There are multiple ways to do so. In this article, we will take a look at these methods for java String contains Ignore Case checks. Next, we will look at each method in detail. Using String.toLowerCase() One of […]

  • public static void main(String args[]) - Java main method
    11 June

    public static void main(String[] args) – Java main method

    If you have worked with Java programs before, you know that all Java programs start by running the main() method(public static void main(String[] args)). The main() method is the entry point. The signature of the main method is fixed, and each portion of the statement has significance. Why is the main method so important? The […]