class TopologyForDeviceAndLinkImpl implements TopologyForDeviceAndLink {

    public void removeLinks(Ip4Address routerId) {
        Map<String, LinkInformation> linkInformationMapLocal = linkInformationMap;
        if (linkInformationMapLocal != null) {
            for (Map.Entry<String, LinkInformation> entry : linkInformationMap.entrySet()) {
                String key = entry.getKey();
                boolean check = key.contains(routerId.toString());
                LinkInformation linkInformation = linkInformationMap.get(key);
                boolean check1 = (linkInformation.linkDestinationId() == routerId) ? true : false;
                if (check || check1) {
                    toRemove.add(key);
                }
            }
            removeLinkFromMap();
        }
    }

}