EnumerableMap vs Array

I've recently come across Enumerable Maps and I'm a bit confused about when to use them.

According to the docs, maps have the following properties:

  • Entries are added, removed, and checked for existence in constant time (O(1)).
  • Entries are enumerated in O(n). No guarantees are made on the ordering.

Which I interpret as requiring one write operation and n read operations (n being the number of keys) to find if a value is in the map.

To me this sounds the same as an array. So my question is, when should I use an EnumerableMap vs when should I use an Array? I'm guessing EnumerableMap is used in those situations when a key/value pair is needed.

Bonus question. What are the differences in terms of gas cost for read and write operations?

Thank you very much.

Because it is a Hash-Map you should be able to check if a key is in the list in O(1).

For gas cost, I would just try both option with a small contract (in Remix).

This means it costs O(n) to enumerate all of them, not for a single read operation where n would be the index as in arrays. Thank you for clarifying.