# Collection - HashMap (Hash table)

### Table of Contents

## 1 - About

A hash map is an implementation of a map that stores the data in buckets. The distribution of the data to a bucket is done by key of the map entry via a hash function (hence a HashMap).

## 2 - Articles Related

## 3 - Usage

A hash map is used in a hash join

## 4 - Performance

- This structure provides constant-time performance for the basic operations (get and put), assuming the hash function disperses the elements properly among the buckets. Hash-Maps are hard to beat in performance for key-based lookups.
- Iteration over collection views requires time proportional to:
- the capacity of the HashMap instance (the number of buckets)
- plus its size (the number of key-value mappings).

## 5 - Properties

### 5.1 - Capacity

- capacity: The capacity is the number of buckets in the hash table.

### 5.2 - Load factor

The load factor is a measure of how full the hash table is allowed to get before its capacity is automatically increased.

A load factor of .75 offers a good tradeoff between time and space costs.

When the number of entries in the hash table exceeds the product of the load factor and the current capacity, the hash table is rehashed (that is, internal data structures are rebuilt) so that the hash table has approximately twice the number of buckets.