Author: misamaliraza94
-
Hash Map
In this tutorial, we will learn about the Java HashMap class and its various operations with the help of examples. The HashMap class of the Java collections framework provides the functionality of the hash table data structure. It stores elements in key/value pairs. Here, keys are unique identifiers used to associate each value on a map. The HashMap class implements the Map interface. Create a HashMap In order…
-
Map Interface
In this tutorial, we will learn about the Java Map interface and its methods. The Map interface of the Java collections framework provides the functionality of the map data structure. Working of Map In Java, elements of Map are stored in key/value pairs. Keys are unique values associated with individual Values. A map cannot contain duplicate keys. And, each key is associated with a…
-
Linked List
Here is how we can create linked lists in Java: Here, Type indicates the type of a linked list. For example, Example: Create LinkedList in Java Output In the above example, we have created a LinkedList named animals. Here, we have used the add() method to add elements to the LinkedList. We will learn more about the add() method later in this tutorial. Working…
-
Deque Interface
In this tutorial, we will learn about the Deque interface, how to use it, and its methods. The Deque interface of the Java collections framework provides the functionality of a double-ended queue. It extends the Queue interface. Working of Deque In a regular queue, elements are added from the rear and removed from the front. However, in a deque,…
-
Priority Queue
In this tutorial, we will learn about the PriorityQueue class of the Java collections framework with the help of examples. The PriorityQueue class provides the functionality of the heap data structure. It implements the Queue interface. Unlike normal queues, priority queue elements are retrieved in sorted order. Suppose, we want to retrieve elements in the ascending order. In this…
-
Queue Interface
In this tutorial, we will learn about the Java Queue interface and its methods. The Queue interface of the Java collections framework provides the functionality of the queue data structure. It extends the Collection interface. Classes that Implement Queue Since the Queue is an interface, we cannot provide the direct implementation of it. In order to use the functionalities of Queue, we…
-
Stack Class
In this tutorial, we will learn about the Java Stack class and its methods with the help of examples. The Java collections framework has a class named Stack that provides the functionality of the stack data structure. The Stack class extends the Vector class. Stack Implementation In stack, elements are stored and accessed in Last In First Out manner. That is, elements are…
-
Java Vector
In this tutorial, we will learn about the Vector class and how to use it. We will also learn how it is different from the ArrayList class, and why we should use array lists instead. The Vector class is an implementation of the List interface that allows us to create resizable-arrays similar to the ArrayList class. Java Vector vs. ArrayList In…
-
ArrayList Class
In this tutorial, we will learn about the ArrayList class in Java. We will learn about different operations and methods of the arraylist with the help of examples. The ArrayList class of the Java collections framework provides the functionality of resizable-arrays. It implements the List interface. Java ArrayList Vs Array In Java, we need to declare the size of an…
-
Java List
In this tutorial, we will learn about the List interface in Java and its methods. In Java, the List interface is an ordered collection that allows us to store and access elements sequentially. It extends the Collection interface. Classes that Implement List Since List is an interface, we cannot create objects from it. In order to use functionalities of the List interface, we…