The “Collections” framework in Java came into action with the release of JDK 1.2 and was expanded quite a few times in Java 1.4 and Java 5 and then again in Java 6.
Continue readinghashmap
Choose the Right Java Collection
Java offers you a variety of collection implementations to choose from. In general you will always look for the collection with the best performance for your programming task, which in most cases is ArrayList, HashSet or HashMap. But be aware, if you need some special features like sorting or ordering you may need to go for a special…
Continue readingJava HashMap Example
Arrays’ items are stored as an ordered collection and we can access them by indices. HashMap class in Java on the other hand, stores items in a group pairs, key/value. They can be accessed by an index of another type. This class does not guarantee that there will be a constant order over time. HashMap provides…
Continue readingJava SortedMap Example
SortedMap interface extends Map and ensures that all entries are in an ascending key order (hence SortedMap). If you want to have it in a descending order, you will need to override the Compare method in the SortedMap which we will do shortly. TreeMap implements SortedMap and it either orders the keys by their natural…
Continue readingJava Iterate through a HashMap Example
Java HashMap Inline Initialization
Following examples demonstrate how to initialize a Java HashMap using standard and inline methods.
Continue readingDifference between HashMap and TreeMap in Java
In this article I will explain the difference between java HashMap and java TreeMap
Continue reading