Courses
Tutorials
Practice
Data Structure
Java
Python
HTML
Interview Preparation
DSA
Practice Problems
C
C++
Java
Python
JavaScript
Data Science
Machine Learning
Courses
Linux
DevOps
SQL
Web Development
System Design
Aptitude
GfG Premium
Similar Topics
DSA
22.5K+ articles
Java
10.5K+ articles
Difference Between
3.6K+ articles
Java Programs
1.9K+ articles
Java-Collections
1.1K+ articles
Java-HashMap
157+ articles
java-hashset
79+ articles
java-TreeMap
74+ articles
Java-List-Programs
55+ articles
java-map
39+ articles
Java-Map-Programs
20 posts
Recent Articles
Popular Articles
Map size() Method in Java With Examples
Last Updated: 02 June 2023
Map size() method in Java is used to get the total number entries i.e, key-value pair. So this method is useful when you want total entries present on the map. If the map ...
read more
Java
Java-Collections
java-map
Java-Map-Programs
How to find the Entry with largest Key in a Java Map
Last Updated: 19 July 2022
Given a map in Java, the task is to find out the entry in this map with the highest key. Examples:Input: Map = {ABC = 10, DEF = 30, XYZ = 20}Output: XYZ = 20Input: Map = {...
read more
Java
java-map
Java-Map-Programs
How to Clone a Map in Java
Last Updated: 21 January 2019
Given a map, the task is to clone that map.Following are the 5 different ways to Clone a Map in Java.Example:{1=Geeks, 2=For, 3=Geeks} Method 1: Naive method1. Create a...
read more
Java
Java-HashMap
java-map
Picked
Java-Map-Programs
Difference Between ArrayList and HashMap in Java
Last Updated: 20 January 2022
ArrayList is a part of the collection framework and is present in java.util package. It provides us with dynamic arrays in Java. Though, it may be slower than standard arr...
read more
Java
Technical Scripter
Java-Collections
Java-ArrayList
Java-HashMap
Technical Scripter 2018
Java-List-Programs
Java-Map-Programs
How to create a TreeMap in reverse order in Java
Last Updated: 25 October 2019
By default TreeMap elements in Java are sorted in ascending order of keys. However, we can create the TreeMap in reverse order using Collections.reverseOrder() method in J...
read more
Java
Java-Collections
java-TreeMap
Picked
Java-Map-Programs
How to check if a key exists in a HashMap in Java
Last Updated: 11 December 2018
Given a HashMap and a key in Java, the task is to check if this key exists in the HashMap or not.Examples:Input: HashMap: {1=Geeks, 2=ForGeeks, 3=GeeksForGeeks}, key = 2Ou...
read more
Java
Java-Collections
Java-HashMap
Java-Map-Programs
Difference between HashMap and HashSet
Last Updated: 06 April 2023
HashSet is an implementation of Set Interface which does not allow duplicate value. The main thing is, objects that are stored in HashSet must override equals() for check ...
read more
Java
Java-Collections
Difference Between
Java-HashMap
java-hashset
Java-Map-Programs
Java-Set-Programs
Program to Convert List to Map in Java
Last Updated: 19 June 2019
The List is a child interface of Collection. It is an ordered collection of objects in which duplicate values can be stored. Since List preserves the insertion order, it a...
read more
Java
Technical Scripter
Java-Collections
java-list
java-map
Technical Scripter 2018
Java-List-Programs
Java-Map-Programs
Sort elements by frequency | Set 5 (using Java Map)
Last Updated: 01 February 2023
Given an integer array, sort the array according to the frequency of elements in decreasing order, if the frequency of two elements are same then sort in increasing orderE...
read more
Arrays
Java
Analysis of Algorithms
Sorting
Hash
Advanced Data Structure
Technical Scripter
Technical Scripter 2018
Java-Map-Programs
DSA
Using TreeMap to sort User-defined Objects in Java
Last Updated: 11 December 2018
Given example shows how to sort user defined objects TreeMap, you can sort the keys based on the logic provided inside the method.Given a record of employees name and sala...
read more
Java
java-TreeMap
Java-Map-Programs
Program to Convert HashMap to TreeMap in Java
Last Updated: 01 October 2021
HashMap is a part of Java’s collection since Java 1.2. It provides the basic implementation of Map interface of Java which stores the data in (Key, Value) pairs. To access...
read more
Java
Java - util package
Java Programs
Java-HashMap
java-TreeMap
Java-Map-Programs
Immutable Map in Java
Last Updated: 03 March 2023
ImmutableMap, as suggested by the name, is a type of Map which is immutable. It means that the content of the map are fixed or constant after declaration, that is, they ar...
read more
Java
Java-Collections
Java - util package
java-guava
java-map
Java-Map-Programs
Count occurrences of elements of list in Java
Last Updated: 31 May 2022
Suppose we have an elements in ArrayList, we can count the occurrences of elements present in a number of ways.HashMapThis data structure uses hash function to map similar...
read more
Java
Java Programs
Java-HashMap
frequency-counting
java-TreeMap
java-hashset
java-list
Java-List-Programs
Java-Map-Programs
Difference between HashMap and ConcurrentHashMap
Last Updated: 06 August 2019
HashMap is the Class which is under Traditional Collection and ConcurrentHashMap is a Class which is under Concurrent Collections, apart from this there are various differ...
read more
Java
Java-Collections
Java-HashMap
Java-Map-Programs
Sorting a HashMap according to keys in Java
Last Updated: 14 April 2025
We are given the details of marks scored by students in form of a HashMap, where the name of the student is the Key and the marks scored is the Value. Our task is to sort ...
read more
Java
Java-Collections
Java-HashMap
Java-Map-Programs
DSA
1
2
We use cookies to ensure you have the best browsing experience on our website. By using our site, you acknowledge that you have read and understood our
Cookie Policy
&
Privacy Policy
Got It !