MethodOccurrence (int frameIndex, @Nullable Method method) { return myCache.computeIfAbsent(frameIndex, __ -> { synchronized (myMethodCounter) { int occurrence = method != null ? myMethodCounter.addTo(method, 1) : 0; return new MethodOccurrence(method, occurrence, frameIndex); } }); }