Skip to content

Commit

Permalink
subList bugfix
Browse files Browse the repository at this point in the history
  • Loading branch information
jcccf committed Jun 28, 2012
1 parent cbeaf53 commit ae9727e
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion examples/java/RandomWalk.java
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -66,7 +66,9 @@ public static void main(String[] args) {


// Sort neighbors (or nodes) in descending number of visits and take the top 10 neighbors // Sort neighbors (or nodes) in descending number of visits and take the top 10 neighbors
List<Integer> topNeighbors = Ordering.natural().onResultOf(Functions.forMap(neighbors)).reverse() List<Integer> topNeighbors = Ordering.natural().onResultOf(Functions.forMap(neighbors)).reverse()
.immutableSortedCopy(neighbors.keySet()).subList(0, 10); .immutableSortedCopy(neighbors.keySet());

if (topNeighbors.size() > 10) topNeighbors = topNeighbors.subList(0, 10);


// Print the top 10 neighbors (and paths) // Print the top 10 neighbors (and paths)
System.out.printf("%8s%10s\t%s\n", "NodeID", "#Visits", "Top 2 Paths with counts"); System.out.printf("%8s%10s\t%s\n", "NodeID", "#Visits", "Top 2 Paths with counts");
Expand Down

0 comments on commit ae9727e

Please sign in to comment.