Showing posts with label Dictionary. Show all posts
Showing posts with label Dictionary. Show all posts

Wednesday, August 12, 2020

How to create a dictionary in Java - Java.util.Dictionary Examples

1. Overview

In this article, You will learn in-depth about the Dictionary class in java and how to create a dictionary in java?

Dictionary is an abstract class in java api which used in collections such as Hashtable. Dictionary supports backend to store the values as key, value pair. Key and Values are should be objects.

In Dictionary, Every key value must be having a value that can be a null or non-null object and keys are not stored in the insertion order. This does not allow duplicate keys.

Since the dictionary is an abstract class so, we can not create an object for it. Hence, object creation is possible to only its implementation classes. As a rule, the equals method should be used by implementations of this class to decide if two keys are the same.

How to create a dictionary in Java - Java.util.Dictionary Examples