int (@Nullable CompilerMessageCategory category) { if (category != null) { Collection<CompilerMessage> collection = myMessages.get(category); return collection != null ? collection.size() : 0; } return myMessages.values().stream().filter(Objects::nonNull).mapToInt(Collection::size).sum(); }