Tutorials
Courses
Go Premium
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
Web Technologies
32.1K+ articles
Java
9.3K+ articles
Misc
7.8K+ articles
Java - util package
1.6K+ articles
Java-Collections
1.1K+ articles
Java-HashMap
159+ articles
java-list
95+ articles
java-TreeMap
74+ articles
Java-List-Programs
57+ articles
java-map
40+ articles
Java-Map-Programs
21 posts
Recent Articles
Popular Articles
Map size() Method in Java With Examples
Last Updated: 15 July 2025
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: 12 July 2025
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: 11 July 2025
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
Picked
Java-HashMap
java-map
Java-Map-Programs
Difference Between ArrayList and HashMap in Java
Last Updated: 11 July 2025
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
Technical Scripter 2018
Java-Collections
Java-ArrayList
Java-HashMap
Java-List-Programs
Java-Map-Programs
How to create a TreeMap in reverse order in Java
Last Updated: 11 July 2025
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
Picked
Java-Collections
java-TreeMap
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: 11 July 2025
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
Technical Scripter
Difference Between
Java-Collections
Java-HashMap
java-hashset
Java-Map-Programs
Java-Set-Programs
Sort elements by frequency | Set 5 (using Java Map)
Last Updated: 11 July 2025
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
Java
Technical Scripter 2018
Java-Map-Programs
Program to Convert List to Map in Java
Last Updated: 11 July 2025
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
Technical Scripter 2018
Java-Collections
java-list
java-map
Java-List-Programs
Java-Map-Programs
Using TreeMap to sort User-defined Objects in Java
Last Updated: 11 July 2025
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
Misc
Java
java-TreeMap
Java-Map-Programs
Program to Convert HashMap to TreeMap in Java
Last Updated: 11 July 2025
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
Misc
Java
Java Programs
Java - util package
Java-HashMap
java-TreeMap
Java-Map-Programs
Immutable Map in Java
Last Updated: 11 July 2025
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
Conversion of Java Map to List
Last Updated: 11 July 2025
In Java, a Map is a collection that maps keys to values and a list is an ordered collection of objects and the List can contain duplicate values.There are some scenarios w...
read more
Java
Java-Collections
java-list
java-map
Java-List-Programs
Java-Map-Programs
Count occurrences of elements of list in Java
Last Updated: 11 July 2025
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
Technical Scripter
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
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 !