class InterfaceManager extends ListenerRegistry<InterfaceEvent, InterfaceListener> implements InterfaceService, InterfaceAdminService {

    @Override
    public Interface getMatchingInterface(IpAddress ip) {
        Optional<Interface> match = interfaces.values()
                .stream()
                .flatMap(set -> set.stream())
                .filter(intf -> intf.ipAddresses()
                        .stream()
                        .anyMatch(intfIp -> intfIp.subnetAddress().contains(ip)))
                .findFirst();

        return match.orElse(null);
    }

}