Skip to content

Glossary: Algorithms Beyond the Basics in Java

computeIfAbsent

A `Map` method that computes and stores a value when a key is missing. It should not be used for recursive memoization, because the recursive call changes the map mid-update and throws `ConcurrentModificationException`; use plain `get` then `put` instead.

Where the book teaches it

Related terms

memoizationConcurrentModificationException