IT lexicon › Programming › Associative array

Associative array

Programming På svenska → Updated: 2026-05-26

Data structure mapping keys to values. Different names per language: dict (Python), hash (Ruby/Perl), HashMap (Java/Rust), Map (JS), object (JS), array (PHP — confusing, PHP's array is associative).

Implementation: usually hash table (O(1) average lookup) or balanced tree (O(log n), sorted). Ordered variants: Python dict (insertion order since 3.7), JS Map (insertion order), Java LinkedHashMap. PHP is unusual — all arrays are associative (even numeric indices are stored as string keys internally). Modern best practice: use typed Maps (TypeScript, Rust) over generic objects for key-value data.

← Back to the lexicon