void (String className, String methodName, int bytecodeOffset, int sourceLine) { Map<String, Map<Integer, Integer>> class_mapping = mapping.computeIfAbsent(className, k -> new LinkedHashMap<>()); // need to preserve order Map<Integer, Integer> method_mapping = class_mapping.computeIfAbsent(methodName, k -> new HashMap<>()); // don't overwrite method_mapping.putIfAbsent(bytecodeOffset, sourceLine); }