Insert entries into a map.
import public |
The put() method inserts an entry into the map. If an entry with the same key already exists, its value will be replaced.
public |
K and V represent the data types of the keys and values stored in the map.
Parameter |
Description |
key |
Required: Specifies the key of the entry. |
value |
Required: Specifies the value of the entry. |
Returns: |
If an entry already existed with the specified key, it returns the value of that entry before overwriting it; otherwise, it returns null. |