!--a11y-->
Data
Structures 
You can speed up access to elements within a data structure by choosing the most suitable structure for your purpose. The tables list different data structures and specify the operations they are most suited for.
Ordered Access
If you need a list where you can precisely control the position where each element is inserted or accessed, use one of the data structures recommended in the following table.
Data Structure |
Suited for |
ArrayList |
Fast read access |
LinkedList |
Suitable if manipulation of the list is required, in particular, for insert and remove operations |
Array of objects |
Fast for a fixed number of elements |
Vector |
Thread-safe therefore suited for concurrent read or write operations |
Random Access
For random access of elements where the key is only permitted one value, use one of the data structures recommended in the table.
Data Structure |
Suited for |
HashMap |
Fast element access for a given key |
HashSet |
Only contains keys. Use if you need to know whether an element is included in a set. |
Hashtable |
Thread-safe therefore suited for for concurrent read or write operations |