Class ArrayMapService
java.lang.Object
com.iu.javadatastructureslab.services.ArrayMapService
Service facade for the
ArrayMap demo.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidAdds or updates a key/value entry.intReturns the current bucket capacity.Returns all stored entries.getMap()Exposes the underlying map instance.intgetSize()Returns the number of stored entries.voidremoveEntry(String key) Removes an entry by key.
-
Constructor Details
-
ArrayMapService
public ArrayMapService()
-
-
Method Details
-
addEntry
Adds or updates a key/value entry.- Parameters:
key- entry keyvalue- entry value
-
removeEntry
Removes an entry by key.- Parameters:
key- entry key to remove- Throws:
IllegalArgumentException- when the key is not found
-
getEntries
Returns all stored entries.- Returns:
- list of entries
-
getSize
public int getSize()Returns the number of stored entries.- Returns:
- entry count
-
getCapacity
public int getCapacity()Returns the current bucket capacity.- Returns:
- bucket capacity
-
getMap
Exposes the underlying map instance.- Returns:
- the backing ArrayMap
-