What is the function of the replace(K key, V value) and replace(K key, V oldValue, V newValue) of the Map interface?
Answer: The first replace() method will replace the value if the provided key matches the provided value; returns the old value if it was successful, returns null if failed. The second replace() method will replace the oldValue with the newValue only if the provided key matches the oldValue. returns true if successful, false if not.
If the answers is incorrect or not given, you can answer the above question in the comment box. If the answers is incorrect or not given, you can answer the above question in the comment box.