Aishwarya Naglot has Published 180 Articles

Add elements at beginning and end of LinkedList in Java

Aishwarya Naglot

Aishwarya Naglot

Updated on 21-Jul-2025 14:34:34

3K+ Views

In general, a linked list is a linear data structure that is a collection of "nodes". Each node contains data and a pointer pointing to the next node. A doubly linked list contains an extra pointer pointing to the previous node, and using this, we can traverse forwards as well ... Read More

Add elements at the middle of a Vector in Java

Aishwarya Naglot

Aishwarya Naglot

Updated on 21-Jul-2025 12:21:00

524 Views

In Java, Vector is a part of the Java Collections Framework that implements a growable array of objects, which changes its size. It is thread-safe, so it can be useful in multi-threaded environments. Add elements at the middle of a Vector in Java We can add elements in the middle ... Read More

Add elements to HashSet in Java

Aishwarya Naglot

Aishwarya Naglot

Updated on 21-Jul-2025 11:49:27

379 Views

The java.util.HashSet class is a part of the Java collection framework. It stores unique elements, which means we cannot store the same element more than once. A HashSet can contain only one null value. If we try to add duplicate elements to a HashSet object, the elements will not be ... Read More

Add months to current date using Calendar.add() method in Java

Aishwarya Naglot

Aishwarya Naglot

Updated on 21-Jul-2025 11:31:51

5K+ Views

The given task is to add months to a date (object) using the add() method of the Calendar class. For example, if we need to add 5 months to the date: 26-06-2025, the new date would be 26-11-2025. Calendar.add() method in Java The calender.add() method in Java is ... Read More

Add elements to HashMap in Java

Aishwarya Naglot

Aishwarya Naglot

Updated on 21-Jul-2025 11:17:08

7K+ Views

HashMap is a part of the Java Collections Framework, it is available in java.util package. It implements the Map interface, and it is used for storing two values at a time: a key and a value. The HashMap key is used to access the associated value. A Java HashMap ... Read More

Add an element to a Stack in Java

Aishwarya Naglot

Aishwarya Naglot

Updated on 21-Jul-2025 11:05:03

4K+ Views

A stack in Java is a data structure that is used for storing elements. It follows the LIFO (Last In, First Out) principle. If we add an element to the stack last, it will be added at the top of the stack (thus it will be the first one ... Read More

Add hours to current time using Calendar.add() method in Java

Aishwarya Naglot

Aishwarya Naglot

Updated on 17-Jul-2025 18:12:08

2K+ Views

What is the Calendar.add() method in Java? The add() method belongs to the java.util.Calendar class. This method is used to add or subtract a specified amount of time to any field of the calendar. For example, we can add months, years, days, hours, minutes, etc., to the current date or ... Read More

Add elements to a Vector in Java

Aishwarya Naglot

Aishwarya Naglot

Updated on 17-Jul-2025 17:54:23

1K+ Views

The java.util.Vector class is a part of the Java Collections Framework. It implements the List interface and is used for storing the elements in a dynamic array. It is similar to an ArrayList but is synchronized (thread-safe). The size of a vector grows dynamically as we add more elements to ... Read More

Java program to convert collection into array

Aishwarya Naglot

Aishwarya Naglot

Updated on 24-Jun-2025 13:23:12

1K+ Views

The Collection is a framework that provides architecture to store and manipulate a group of objects. Java Collections can achieve all the operations that you perform on data, such as searching, sorting, insertion, manipulation, and deletion. In this article, we will understand how to convert a collection into an array ... Read More

Java program to perform the inorder tree traversal

Aishwarya Naglot

Aishwarya Naglot

Updated on 24-Jun-2025 13:15:51

1K+ Views

In-order traversal processes each node by visiting the left subtree first, then the node,  and finally the right subtree. This is particularly useful for certain types of tree structures, such as binary search trees, where in-order traversal will print the values in sorted order. In this article, we will explore ... Read More

Previous 1 ... 4 5 6 7 8 ... 18 Next
Advertisements