Class ArrayMapController
java.lang.Object
com.iu.javadatastructureslab.controller.ArrayMapController
Handles requests for the ArrayMap demo page.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionaddToArrayMap(String key, String value) Adds a key/value entry to the ArrayMap.arrayMap(org.springframework.ui.Model model) Renders the ArrayMap view with current entries and size metadata.removeFromArrayMap(String key) Removes an entry from the ArrayMap by key.
-
Constructor Details
-
ArrayMapController
public ArrayMapController()
-
-
Method Details
-
arrayMap
Renders the ArrayMap view with current entries and size metadata.- Parameters:
model- model used to expose view attributes- Returns:
- the ArrayMap view name
-
addToArrayMap
@PostMapping("/arraymap/add") public String addToArrayMap(@RequestParam String key, @RequestParam String value) Adds a key/value entry to the ArrayMap.- Parameters:
key- entry keyvalue- entry value- Returns:
- redirect to the ArrayMap view
-
removeFromArrayMap
Removes an entry from the ArrayMap by key.- Parameters:
key- entry key to remove- Returns:
- redirect to the ArrayMap view
-