From 4a27eb03386843ac7fd99444d64da725fe9525f5 Mon Sep 17 00:00:00 2001 From: Haifeng Li Date: Wed, 25 Dec 2024 20:24:57 -0500 Subject: [PATCH] Comparator.comparingDouble() --- base/src/main/java/smile/graph/NearestNeighborGraph.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/base/src/main/java/smile/graph/NearestNeighborGraph.java b/base/src/main/java/smile/graph/NearestNeighborGraph.java index 8a6987366..03da54dc5 100644 --- a/base/src/main/java/smile/graph/NearestNeighborGraph.java +++ b/base/src/main/java/smile/graph/NearestNeighborGraph.java @@ -438,7 +438,7 @@ private static int[][] generateCandidates(List> heapList int[][] result = new int[n][]; for (int i = 0; i < n; i++) { List 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;