Implement MutableTrieMap.computeIfAbsent() #147
Labels
enhancement
New feature or request
good first issue
Good for newcomers
help wanted
Extra attention is needed
We currently rely on default implementation from ConcurrentMap. That implementation defers to get() and then to putIfAbsent() -- which means that we end up traversing the tree twice, whereas given the key we know the insertion point.
We should be doing better than that, provided we can plug into our lookup machinery that is :)
The idea is that the get() operation is inevitably finding an existing entry or at least something close to the insertion point. Once we have established that point and the mapping does not exist, we should consult the mapping function. If it produces a non-null value, we should perform an insert operation based on the context.
Implementation-wise this is mostly about INode and its methods: it feels like an extension of recInsertIf().
The text was updated successfully, but these errors were encountered: