Insert entries into a map.
import public
|
The putIfAbsent() method inserts an entry into the map. If an entry with the same key already exists and its value is not null, the map remains unchanged.
public |
K and V represent the data types of the keys and values in the map.
Parameter |
Description |
key |
Required: Specifies the key for the map entry. |
value |
Required: Specifies the value for the map entry. |
Returns: |
If an entry exists with the specified key, it returns the value of that entry; otherwise, it returns null. |