Skip to content

Glossary: Data Structures and Algorithms in Java

computeIfAbsent

A `Map` method that returns the value for a key, first creating and storing it from a lambda if the key is missing. It is handy for building an adjacency list, where a place's empty neighbor list is created the first time the place appears.

Where the book teaches it

Related terms

adjacency listlambda