• 17 May

    How to Add Multiple Values for Single Key In HashMap in Java

    This article discusses the HashMap in Java and how to add multiple values for Single Key In HashMap in Java. HashMap The HashMap in Java is an instrument that allows efficient access, insertion, deletion, and updating using the indexing concept by storing data in the form of key and value pairs. It was introduced in […]

  • java.lang.ClassCastException: java.util.Arrays$ArrayList cannot be cast to java.util.ArrayList
    22 February

    [Fixed] java.lang.ClassCastException: java.util.Arrays$ArrayList cannot be cast to java.util.ArrayList

    In this post, we will see how to fix java.lang.ClassCastException: java.util.Arrays$ArrayList cannot be cast to java.util.ArrayList. ClassCastException is runtime exception which indicate that code has tried to cast an object to a subclass which is not an instance. Reason for java.lang.ClassCastException: java.util.Arrays$ArrayList cannot be cast to java.util.ArrayList Although static method Arrays.asList() returns List, it returns […]

  • Java ArrayList of objects
    25 January

    Create ArrayList of Objects in Java

    In this tutorial, we will learn how to create ArrayList of objects in Java. We will create a Book class with different properties and use it to create custom book objects when creating an ArrayList of objects. We will filter these book objects using certain criteria and add the book objects that meet the criteria […]

  • 10 September

    How to remove element from Arraylist in java while iterating

    Introduction In this tutorial, you will learn how to remove element from Arraylist in java while iterating using different implementations provided by Java. It is necessary to understand the right way to remove items from a List because we might encounter errors in our programs if not done correctly. For example, If we try to […]

  • 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. […]

  • Print ArrayList in java
    11 May

    Print ArrayList in Java

    Learn about how to print ArrayList in java in different ways.

  • 02 October

    Initialize ArrayList with values in Java

    In this article, we will learn to initialize ArrayList with values in Java. ArrayList is an implementation class of List interface in Java. It is used to store elements. It is based on a dynamic array concept that grows accordingly. We can Initialize ArrayList with values in several ways. Let’s see some of them with […]

  • 15 April

    How to Deep Copy Arraylist in Java

    Learn about how to create deep copy of ArrayList in different ways.