Category Archives: Java

🔗 Java Interview Preparation Guide

Welcome to the Java Interview Preparation Guide! This guide is designed to help you prepare for your upcoming Java programming interviews. In this guide, you will find a collection of important Java programming topics that will help you ace your next interview. Whether you are a seasoned Java developer or a beginner, this guide has something for you. Let’s get started!

Continue reading 🔗 Java Interview Preparation Guide

Overview of New Features in Java 19

Java 19 is the latest version of the Java programming language. It was released on September 20, 2022, and it comes with numerous new features and improvements. Some of the most notable changes in Java 19 include the introduction of pattern matching for switch statements, the enhanced packaging tool, the removal of the volatile keyword from most fields in the java.util.concurrent package, and the introduction of new APIs for regular expressions, among many others.

You can download Java 19 here.


New in Java 19:

Apache Commons Collection – MultiValuedMap

Apache Commons Collection is a library of useful data structures, collections, and algorithms in Java. MultiValuedMap is one of the data structures present in the Apache Commons Collection. MultiValuedMap is a Map that allows multiple values for a single key. It is a useful implementation of a one-to-many relationship. You can add multiple values to the same key, and the key-value pairs are stored in the order in which they are added.

Here’s an example Java code of using MultiValuedMap:

import org.apache.commons.collections4.MultiValuedMap;
import org.apache.commons.collections4.multimap.ArrayListValuedHashMap;
public class MultiValuedMapDemo {
    public static void main(String[] args) {
        MultiValuedMap<String, String> multiValuedMap = new ArrayListValuedHashMap<>();
        multiValuedMap.put("Key1", "Value1");
        multiValuedMap.put("Key1", "Value2");
        multiValuedMap.put("Key2", "Value3");
        System.out.println(multiValuedMap.get("Key1"));
    }
}

Continue reading Apache Commons Collection – MultiValuedMap