Skip to content

Commit

Permalink
Switch to min
Browse files Browse the repository at this point in the history
  • Loading branch information
steffenaxer committed Dec 30, 2023
1 parent aee64ef commit a736f9a
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -69,9 +69,9 @@ public static Link findStraightLineNearestDepot(DvrpVehicle vehicle, Set<Link> l
null /* already at a depot*/ :
links.stream().map(l -> new DepotCandidates(l, DistanceUtils.calculateSquaredDistance(currentLink.getToNode().getCoord(),
l.getFromNode().getCoord())))
.sorted(Comparator.comparing(DepotCandidates::distance)
.min(Comparator.comparing(DepotCandidates::distance)
.thenComparing(h -> h.link.getId()))
.findFirst().get().link();
.get().link();
}

record DepotCandidates(Link link, double distance) {}
Expand Down

0 comments on commit a736f9a

Please sign in to comment.