Comparing data structures
We've now seen five different data structures that allow us to store multiple values within a single field. Each data structure has certain advantages and disadvantages, and each is best suited to particular use cases. In the following table, we summarize the important features of each of the data structures from this chapter:
Set | List | Map | Tuple | User-defined Type | |
Size | Flexible | Flexible | Flexible | Fixed | Fixed |
Discrete updates | Yes | Yes | Yes | No | No |
Partial Selection | No | No | No | No | Yes |
Name-value pairs | No | No | Yes | No | Yes |
Multiple Types | No | No | Keys and Values | Yes | Yes |
Index | Individual elements | Individual elements | Individual elements | Entire value | Entire value |
Can be used as primary key | No | No | No | Yes | Yes |