In general, Map is a data structure consisting of a set of key-value pairs, and each key can only appears once in the map. This post summarizes Top 9 FAQ of how to use Java Map and its implemented classes. For sake of simplicity, I will use generics in examples. Therefore, I will just write Map
instead of specific Map
. But you can always assume that both the K and V are comparable, which means K extends Comparable
and V extends Comparable
.