Avoid Recursion in ConcurrentHashMap.computeIfAbsent()

Sometimes we give terrible advice. Like in that article about how to use Java 8 for a cached, functional approach to calculating fibonacci numbers. As Matthias, one of our readers, noticed in the comments, the proposed algorithm may just never halt. Consider the following program: public class Test { static Map<Integer, Integer> cache = new … Continue reading Avoid Recursion in ConcurrentHashMap.computeIfAbsent()