Package dsa.lab06.exercises
Class ProbingHashMap<Key,Value> 
java.lang.Object
dsa.lab06.exercises.ProbingHashMap<Key,Value> 
- Type Parameters:
- Key- the key type
- Value- the value type
- All Implemented Interfaces:
- Container<MapItem<Key,,- Value>> - Map<Key,,- Value> - Iterable<MapItem<Key,- Value>> 
A (linearly-)probing hash map.
- 
Constructor SummaryConstructorsConstructorDescriptionConstruct an empty probing hash map.ProbingHashMap(MapItem<Key, Value>... items) Construct a probing hash map containing the given items.ProbingHashMap(Iterable<MapItem<Key, Value>> items) Construct a probing hash map containing the given items.ProbingHashMap(Iterable<MapItem<Key, Value>> items, int size) Construct a probing hash map containing the given items more efficiently thanProbingHashMap(Iterable).
- 
Method SummaryMethods inherited from class java.lang.Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface java.lang.IterableforEach, spliteratorMethods inherited from interface dsa.lab04.base.MapcontainsKey, containsValue, get, insert, keys, values
- 
Constructor Details- 
ProbingHashMappublic ProbingHashMap()Construct an empty probing hash map.
- 
ProbingHashMapConstruct a probing hash map containing the given items.- Parameters:
- items- the items
 
- 
ProbingHashMapConstruct a probing hash map containing the given items more efficiently thanProbingHashMap(Iterable).- Parameters:
- items- the items
- size- the number of items
- Throws:
- IllegalArgumentException- if- size!=- n(where- nis- items's size)
 
- 
ProbingHashMapConstruct a probing hash map containing the given items.- Parameters:
- items- the items
 
 
- 
- 
Method Details- 
sizepublic int size()Description copied from interface:ContainerGet the number of contained items.
- 
insertDescription copied from interface:MapInsert the given item.If there's already an item with the same key, that item is replaced with this one. This means that if the key was not already contained, the size is incremented, otherwise it isn't. 
- 
findDescription copied from interface:MapFind the item with the given key.- Specified by:
- findin interface- Map<Key,- Value> 
- Parameters:
- key- the item's key
- Returns:
- the item
- Throws:
- NoSuchElementException- if no item has key- key
 
- 
removeDescription copied from interface:MapRemove and return the item with the given key.Decrements the size (assuming the item was actually in the map). - Specified by:
- removein interface- Map<Key,- Value> 
- Parameters:
- key- the item's key
- Returns:
- the item
- Throws:
- NoSuchElementException- if- keyis not contained
 
- 
itemsDescription copied from interface:ContainerGet an iterable that yields each item once.
 
-