Maps—Associative Data

Raheelanjum
4 min readDec 10, 2024

A "mapping" is a relationship between two entities. For example, the phone book is a mapping between names (type == string) and numbers (type == number). Arrays are a very basic "mapping" between a number and a value. Often the only relationship in an array is the "bucket index" that the data happens to be placed in. In a MAP, there is a much more defined notion of this relationship.

Maps

Matlab provides the use of the JAVA language for advanced programming techniques. For our purposes, we will simply "use" predefined Java "data types." The one we are interested in is the "map" or "hashtable.".

A map in computer terms is a relationship (or association) between one "value" and another "value." The Map is an advanced data type that allows you to assign a value (the data to be "linked" (or associated with)) with a "key" (the "value" used to look up the data). The key is often a string but could be any type of data.

Map/Hashtable Terms

Key: The value that is used to look up another value. For example, in a phone book, the key is the name and the value is the phone number:

Value: The data associated with each key. Every key that has been entered into a hash table must have one (and only one) value associated with it.

Map Syntax

--

--

Raheelanjum
Raheelanjum

Written by Raheelanjum

Highly skilled and experienced content writer dedicated to crafting compelling, informative content that resonates with diverse audiences. Expertise spans blog

Responses (9)