diff --git a/src/main/java/org/commoncrawl/webgraph/explore/Graph.java b/src/main/java/org/commoncrawl/webgraph/explore/Graph.java index 1b944e4..6fec31a 100644 --- a/src/main/java/org/commoncrawl/webgraph/explore/Graph.java +++ b/src/main/java/org/commoncrawl/webgraph/explore/Graph.java @@ -255,8 +255,11 @@ public Stream> topLevelDomainCounts(IntStream vertexIds) { } count++; } - curr = next; res.add(new SimpleEntry<>(tld, count)); + curr = next; + if (!iter.hasNext()) { + break; + } } while (curr > -1); } return res.stream().sorted(Collections.reverseOrder(Map.Entry.comparingByValue()));