class ExceptionStatusMapper {

    Optional<HttpResponseStatus> statusFor(Throwable throwable) {
        List<HttpResponseStatus> matchingStatuses = this.multimap.entries().stream()
                .filter(entry -> entry.getValue().isInstance(throwable))
                .sorted(comparing(entry -> entry.getKey().code()))
                .map(Map.Entry::getKey)
                .collect(toList());

        if (matchingStatuses.size() > 1) {
            LOG.error("Multiple matching statuses for throwable={} statuses={}", throwable, matchingStatuses);
            return Optional.empty();
        }

        return matchingStatuses.stream().findFirst();
    }

    private  ExceptionStatusMapper(Builder builder);

}