Skip to content

Commit

Permalink
Comparator.comparingDouble()
Browse files Browse the repository at this point in the history
  • Loading branch information
haifengl committed Dec 26, 2024
1 parent 7934e8c commit 4a27eb0
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion base/src/main/java/smile/graph/NearestNeighborGraph.java
Original file line number Diff line number Diff line change
Expand Up @@ -438,7 +438,7 @@ private static int[][] generateCandidates(List<PriorityQueue<Neighbor>> heapList
int[][] result = new int[n][];
for (int i = 0; i < n; i++) {
List<Neighbor> list = new ArrayList<>(candidates.get(i));
list.sort((o1, o2) -> Double.compare(o1.distance, o2.distance));
list.sort(Comparator.comparingDouble(o -> o.distance));
result[i] = list.stream().limit(maxCandidates).mapToInt(neighbor -> neighbor.index).toArray();
}
return result;
Expand Down

0 comments on commit 4a27eb0

Please sign in to comment.