Posts tagged "Java Collection "

Tag Archives: Java Collection

Properties Class in Java

Let’s learn about the Properties Class in Java.  Normally, Java properties file is used to store project configuration data or settings. The properties object contains key-value pair both as a string. It is the subclass of Hashtable. The Properties class provides methods to get data from the properties file and store data into the properties file. It can … Continue reading Properties Class in Java

ArrayList vs Vector

In this Java tutorial, we will discuss the difference between ArrayList and Vector. ArrayList and Vector both implements List interface and maintains insertion order and both use Array as a data structure internally. However, there are few differences in the way they store and process the data. In this post, we will discuss the difference and … Continue reading ArrayList vs Vector

Difference in Hashtable and HashMap

In the previous tutorials. We have learned about the HashMap and HashTable. In this tutorial, we will learn about the Similarities and Differences in HashMap and HashTable.   We will also see When to use hashmap and when to use a hashtable. Although both classes implement the Map in java there are some key differences in … Continue reading Difference in Hashtable and HashMap

TreeMap in Java

TreeMap in Java implements the NavigableMap interface of the Map interface.  TreeMap is Red-Black tree based NavigableMap implementation. The main difference between HashMap and TreeMap is that HashMap is an unordered collection while TreeMap is sorted in the ascending order of its keys.   TreeMap is unsynchronized collection class which means it is not suitable for … Continue reading TreeMap in Java

HashMap vs ArrayList

In the tutorial, you will learn about the difference in HashMap and ArrayList or HashMap vs ArrayList in Java.   HashMap and ArrayList are two different Collection class in Java. They both used to store objects but they are completely different on their implementation and working. The main difference between ArrayList and HashMap is that ArrayList is index based data-structure backed by Array while HashMap is map data structure which works … Continue reading HashMap vs ArrayList

Serialize vs Synchronized HashMap

In the tutorial, we will discuss Serialize vs synchronized HashMap in Java with an example.   Serialized HashMap in Java HashMap class is serialized by default which means we need not implement Serializable interface in order to make it eligible for Serialization. Let’s discuss the serialization and De-serialization first.   Serialization  – Serialization is a process of … Continue reading Serialize vs Synchronized HashMap

HashMap in Java

HashMap class implements the Map interface in Java. Some important points about HashMap class- HashMap store the elements in Key-Value pair. HashMap contains only unique elements i.e You can’t use the same key-value pair again. HashMap may have one null key and multiple null values. HashMap maintains no order. HashMap is non-synchronized class.   Example of … Continue reading HashMap in Java