Java Reference
In-Depth Information
Map::computeIfAbsent
Takes a key and a lambda expression that maps the key type to the value type. If
the specified key (first parameter) is not present in the map, then, computes a
default value by using the lambda expression and puts it in the map.
(See also Map::computeIfPresent , Map::compute , and Map::merge .)
Conclusion
In this chapter, we've met the Java Collections libraries, and seen how to start work‐
ing with Java's implementations of fundamental and classic data structures. We've
met the general Collection interface, as well as List , Set , and Map . We've seen the
original, iterative way of handling collections, and also introduced the new Java 8
style, based on ideas from fundamental programming. Finally, we've met the
Streams API and seen how the new approach is more general, and is able to express
more subtle programming concepts than the classic approach.
Let's move on. In the next chapter, we'll continue looking at data, and common tasks
like text processing, handling numeric data, and Java 8's new date and time libraries.
Search WWH ::




Custom Search