To remove an item, use the remove()
method and refer to the key:
Example
capitalCities.remove("England");
To remove all items, use the clear()
method:
Example
capitalCities.clear();
Practice Excercise Practice now
To remove an item, use the remove()
method and refer to the key:
capitalCities.remove("England");
To remove all items, use the clear()
method:
capitalCities.clear();
Practice Excercise Practice now