- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- 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 2616 Articles for Java
![AmitDiwan](https://www.tutorialspoint.com/assets/profiles/123055/profile/60_187394-1565938756.jpg)
430 Views
In this article, we will understand how to sort map by keys. The Java Map interface, java.util.Map, represents a mapping between a key and a value. More specifically, a Java Map can store pairs of keys and values. Each key is linked to a specific value.Below is a demonstration of the same −Suppose our input is −Input map: {1=Scala, 2=Python, 3=Java}The desired output would be −The sorted map with the key: {1=Scala, 2=Python, 3=Java}AlgorithmStep 1 - START Step 2 - Declare namely Step 3 - Define the values. Step 4 - Create a Map structure, and add values to it ... Read More
![AmitDiwan](https://www.tutorialspoint.com/assets/profiles/123055/profile/60_187394-1565938756.jpg)
878 Views
In this article, we will understand how to check if a set is the subset of another set. 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.Below is a demonstration of the same −Suppose our input is −First set: [90, 75, 60, 45] Second set : [90, 60]The desired output would be −Is a sets sub-set of the other? trueAlgorithmStep 1 - START Step 2 - Declare namely Step 3 - Define the values. Step ... Read More
![AmitDiwan](https://www.tutorialspoint.com/assets/profiles/123055/profile/60_187394-1565938756.jpg)
626 Views
In this article, we will understand how to calculate the difference between two sets. 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.Below is a demonstration of the same −Suppose our input is −First set: [90, 75, 60, 45] Second set: [90, 60]The desired output would be −After subtraction of two sets: [75, 45]AlgorithmStep 1 - START Step 2 - Declare namely Step 3 - Define the values. Step 4 - Create two Sets, and ... Read More
![AmitDiwan](https://www.tutorialspoint.com/assets/profiles/123055/profile/60_187394-1565938756.jpg)
251 Views
In this article, we will understand how to detect loop in a LinkedList. A linked list is a sequence of data structures, which are connected together via links. Linked List is a sequence of links which contains items. Each link contains a connection to another link.Below is a demonstration of the same −Suppose our input is −Run the programThe desired output would be −The loop exists in the linked listAlgorithmStep 1 - START Step 2 - Declare namely Step 3 - Define the values. Step 4 - Define the class with the relevant members. Step 5 - Create an instance ... Read More
![AmitDiwan](https://www.tutorialspoint.com/assets/profiles/123055/profile/60_187394-1565938756.jpg)
4K+ Views
In this article, we will understand how to get key from HashMap using the value. 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=8, Scala=5, Python=15} Key: 8The desired output would be −The value of Key: 8 is JavaAlgorithmStep 1 - START Step 2 - Declare namely Step 3 - Define the values. Step 4 - Create a HashMap of integer and string values and initialize elements in it using the ‘put’ method. Step 5 - Define ... Read More
![AmitDiwan](https://www.tutorialspoint.com/assets/profiles/123055/profile/60_187394-1565938756.jpg)
3K+ Views
In this article, we will understand how to remove duplicate elements from arrayList. 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.Below is a demonstration of the same −Suppose our input is −Input list : [150, 250, 300, 250, 500, 150, 600, 750, 300]The desired output would be −The list with no duplicates is: [150, 250, 300, 500, 600, 750]AlgorithmStep 1 - START Step 2 - Declare namely Step 3 - Define the ... Read More
![AmitDiwan](https://www.tutorialspoint.com/assets/profiles/123055/profile/60_187394-1565938756.jpg)
558 Views
In this article, we will understand how to update value of HashMap using key. 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=1, Scala=2, Python=3}The desired output would be −The HashMap with the updated value is: {Java=1, Scala=12, Python=3}AlgorithmStep 1 - START Step 2 - Declare namely Step 3 - Define the values. Step 4 – Create a hashmap of values and initialize elements in it using the ‘put’ method. Step 5 - Display the hashmap on ... Read More
![AmitDiwan](https://www.tutorialspoint.com/assets/profiles/123055/profile/60_187394-1565938756.jpg)
1K+ Views
In this article, we will understand how to iterate over a set. 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.Below is a demonstration of the same −Suppose our input is −Input set: [Java, Scala, Mysql, Python]The desired output would be −Iterating over Set using for-each loop: Java, Scala, Mysql, PythonAlgorithmStep 1 - START Step 2 - Declare namely Step 3 - Define the values. Step 4 - Create a hashset of values and initialize elements ... Read More
![AmitDiwan](https://www.tutorialspoint.com/assets/profiles/123055/profile/60_187394-1565938756.jpg)
328 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
![AmitDiwan](https://www.tutorialspoint.com/assets/profiles/123055/profile/60_187394-1565938756.jpg)
284 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.Below is a demonstration of the same −Suppose our input is −Input string: Java ProgramThe desired output would be −The array after conversion from string is: J a v a P r o g r a mAlgorithmStep 1 - START Step 2 - Declare namely Step 3 ... Read More