Java Dictionary

Coding Aryan
1 min readApr 23, 2023

--

In java Dictionary, util.Dictionary is an abstract class that denotes a key-value storage repository and behaves like a map.

If a key and some values are given, values can be stored in the object of the dictionary. After saving the value, it can be retrieved by using the key. That is why the dictionary is said to be working similarly to maps.

Constructors, declaration, and further other details on the dictionary class will be discussed in the following sections.

Declaration

Below is the declaration of the dictionary class.

Constructors

The following is the only constructor of the Dictionary class.

Dictionary() : Sole constructor.

How does Java Dictionary class work?

As discussed above, dictionary class is an abstract class that behaves similarly to the map. If the key and certain values are provided, values can be saved in the dictionary object.

After storing the value, it can be retrieved by using the key. Any non-null key and value can be used in this class.

Java Dictionary Class Methods

elements()

An enumeration will be returned for the values available in the dictionary.

Syntax:

Code:

Two elements are added to the dictionary, and the values of those keys are retrieved using the elements() method.

Read Full Post below 👇

https://www.instagram.com/p/CrVgnCZriXU/?igshid=YmMyMTA2M2Y=

--

--

Coding Aryan
Coding Aryan

Written by Coding Aryan

Hi friends, welcome to Coding Aryan, here you can find all interview questions with answers for asp.net , c#, MVC, javascript , angular 2 , asp.net core etc.

No responses yet