Sets and dictionaries
Our journey through Spring collections is almost at its end. Before we discover wonderful sets and dictionaries, I have to – albeit briefly – mention hash tables. They will appear extensively in this section, and although I don’t have space to talk about them, I can at least describe them in general terms.
Hash tables
The simplest way to introduce hash tables is to start with arrays. An array is a linear structure containing multiple elements of the same type, where we can use an offset from the start (an index) to access one element of the array. We can, for example, write a simple code fragment to store some strings in an array:
var names: array [1..3] of string; names[1] := 'Spring'; names[2] := 'February'; names[3] := 'Wednesday';
A hash table is a generalization of this concept. Instead of using integer values, we can use data of any type for the index (in hash tables, we call this...