@Override
    public List<LinkRelevance> getSelectedLinks() {
        List<LinkRelevance> links = new ArrayList<>();
        while (links.size() < numberOfLinks && !topkLinksPerDomain.isEmpty()) {
            // adds the URL with max score of each domain
            MinMaxPriorityQueue<LinkRelevance> topk = newPriorityQueue(numberOfLinks);
            Iterator<Entry<String, MinMaxPriorityQueue<LinkRelevance>>> it = topkLinksPerDomain.entrySet().iterator();
            while (it.hasNext()) {
                MinMaxPriorityQueue<LinkRelevance> domain = it.next().getValue();
                topk.add(domain.poll());
                if (domain.isEmpty()) {
                    it.remove();
                }
            }
            for(LinkRelevance link : topk) {
                links.add(link);
            }
        }
        this.topkLinksPerDomain = null; // clean-up reference
        return links;
    }
Implements a link selection strategy that tries to select the top-k links from all different
top-level domains.
ache/src/main/java/achecrawler/link/frontier/selector/MaximizeWebsitesLinkSelector.java