newHashMap( ( map | list | maplet )... )

Returns a new modifiable map, initialized with the specified items.

The map is implemented on top of a hash table, which has a couple of trade offs. There are no guarantees regarding the order of key-value pairs in the map, indeed the order map change as key-value pairs are added and modified. Adding, retrieving and modifying key-value pairs is a constant time operation, i.e. regardless of the size of the map these operations will take a constant time. Iterating over all the key-value pairs in the map is proportional to the capacity of the map and the number of key-value pairs defined. Finally, when adding lots of key-value pairs, the map may need to increase it's capacity resulting in a rehashing operation.

The map is initialized with the items you supply as arguments. This function deals with arguments in exactly the same way as the newMap function, so that information isn't repeated here.

Notes

If you know that you will not add or modify key-value pairs to the map that often, but will iterate over them a lot, consider using newLinkedHashMap instead.

If the order in which you iterate over the key-value pairs in the map must match the order you inserted them, you must use newLinkedHashMap instead.

If you know that you will add or modify key-value pairs in the map often and are happy with iterating over the key-value pairs in the natural ascending sort order of the keys, consider using newTreeMap instead.

If you want a map where the key-value pairs are automatically removed when the key is no longer in use, consider using newWeakHashMap instead.