
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Found 67 Articles for Campus Interview

6K+ Views
Java HashMap is a hash table-based implementation of Java's Map interface. It is a collection of key-value pairs. In this article, we will understand how to get a key from a HashMap using the value. Following are the ways to get a key from a HashMap using the value: Using For Loop Using Stream API Using For Loop We can iterate through the entries of the HashMap using a for loop and check if the value matches the one we are looking for. If it does, we return the corresponding ... Read More

3K+ Views
ArrayList class in Java is a part of the Java Collections Framework and is used for storing a dynamically sized collection of elements. It is similar to an array, but it can grow and shrink in size according to the requirements of the program.Removing Duplicate Elements from an ArrayList In an ArrayList, we can store duplicate elements. In this article, we will see how to remove duplicate elements from an ArrayList in Java. The following are the methods we will use to remove duplicate elements from an ArrayList: Using removeIf() Method ... Read More

886 Views
HashMap is a part of the Java Collections Framework, and it is used for storing key-value pairs. In this article, we will see how to update the value of a HashMap using a key. We will use following methods to update the value of a HashMap: Using put() Method Using compute() Method Using replace() Method Using put() Method The put() method is used to add a key-value pair to the HashMap. If the key already exists, it will update the value that is stored with that ... Read More

2K+ Views
A Set is a Collection that cannot contain duplicate elements. It models the mathematical set abstraction. The Set interface contains only methods inherited from Collection and adds the restriction that duplicate elements are prohibited. In this example, we will see how to iterate over a Set in Java using the following methods: Using forEach() Method Using Stream API Using forEach() Method The forEach() method from the Set is used for iterating over each element of the set. We can use this method to perform an action for each element in ... Read More

461 Views
In this article, we will understand how to iterate over a HashMap. Java HashMap is a hash table based implementation of Java's Map interface. It is a collection of key-value pairs.Below is a demonstration of the same −Suppose our input is −Input Hashmap: {Java=Enterprise, JavaScript=Frontend, Mysql=Backend, Python=ML/AI}The desired output would be −The keys of the Hashmap are: Java, JavaScript, Mysql, Python, The Values of the Hashmap are: Enterprise, Frontend, Backend, ML/AI, AlgorithmStep 1 - START Step 2 - Declare namely Step 3 - Define the values. Step 4 - Create a hashmap of strings and initialize elements in it using ... Read More

411 Views
In this article, we will understand how to convert the ArrayList into a string and vice versa. The ArrayList class is a resizable array, which can be found in the java. util package. The difference between a built-in array and an ArrayList in Java is that the size of an array cannot be modified. ArrayList definitionAn ArrayList in Java is a resizable array found in the java.util package, which allows for dynamic modifications in size as elements are added or removed. It supports ... Read More

397 Views
In this article, we will understand how to convert the linked list into an array and vice versa. The java.util.LinkedList class operations perform we can expect for a doubly-linked list. Operations that index into the list will traverse the list from the beginning or the end, whichever is closer to the specified index.Below is a demonstration of the same −Suppose our input is −The list is defined as: [Java, Python, Scala, Mysql]The desired output would be −The result array is: Java Python Scala MysqlAlgorithmStep 1 - START Step 2 - Declare namely Step 3 - Define the values. Step 4 ... Read More

258 Views
The java.util.LinkedList class represents a linked list in Java, specifically a doubly-linked list, i.e., we can traverse through the list either from the beginning or from the end, whichever is closer to the specified index. We can create and perform various operations on a linked list using the methods provided by this class.Retrieving the Middle Element of a LinkedList In this article, we will understand how to find the middle element of a LinkedList using Java. We will use the following ways to do so: Using a While Loop Using size() ... Read More

3K+ Views
A Queue is a linear structure that follows a particular order in which the operations are performed. The order is First In, First Out (FIFO). In a queue, the element added first will be removed first. The end where elements are added is called the rear, and the end where elements are removed is called the front. Scenario 1 Let us see an example, scenario: Input: [150, 300, 450, 600] After removing an element from the queue: Output: [300, 450, 600] The following are the ways to implement a queue in Java: Using Array ... Read More

1K+ Views
A Graph is a non-linear data structure made up of a group of vertices and edges. A vertex or node represent an object, and the connections between them are called edges. In this article, we will understand how to implement the graph data structure in Java. Algorithm Step 1: START Step 2: Create a class and its constructor to initialize graph. In this class, use LinkedList for creating adjacency list. Step 3: Define a method in the same class to add edges to the graph. ... Read More