Java HashMap.putIfAbsent() is a method in the Java HashMap class that inserts a key-value pair into the map only if the key is not already present. If the key exists, it returns the existing value associated with that key without modifying the map. Introduced in Java 2014 with Java 8, putIfAbsent() is useful for avoiding overwriting values in concurrent applications and ensuring safe key insertions.
https://docs.oracle.com/javase/8/docs/api/java/util/HashMap.html