Answer the question
In order to leave comments, you need to log in
How does the computeIfAbsent function work in Java?
Please help me with the following Java code:
private void loadYamlMatcher(MappingNode entry, String filename) {
List<MappingNode> matcherConfigList = matcherConfigs
.computeIfAbsent(filename, k -> new ArrayList<>(32));
matcherConfigList.add(entry);
}
Answer the question
In order to leave comments, you need to log in
I suspect matcherConfigs is a HashMap and HashMap is an unordered collection.
This class makes no guarantees as to the order of the map; in particular, it does not guarantee that the order will remain constant over time.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question