class ErrorResponses {

    static Map<String, Object> buildServerContext() {
        Map<String, Object> result = new TreeMap<>();

        Optional<String> hostName = NetworkExt.getHostName();
        if (hostName.isPresent()) {
            result.put("hostName", hostName.get());
        }
        Optional<List<String>> localIPs = NetworkExt.getLocalIPs();
        if (localIPs.isPresent()) {
            List<String> nonLoopbackIPs = localIPs.get().stream().filter(ip -> !NetworkExt.isLoopbackIP(ip)).collect(Collectors.toList());
            result.put("ipV4", nonLoopbackIPs.stream().filter(ip -> !NetworkExt.isIPv6(ip)).collect(Collectors.toList()));
            result.put("ipV6", nonLoopbackIPs.stream().filter(NetworkExt::isIPv6).collect(Collectors.toList()));
        }
        return result;
    }

    private  ErrorResponses();

}