From a736f9a10e361dac7c1f2e206de9de33e84b11dc Mon Sep 17 00:00:00 2001 From: steffenaxer <26229392+steffenaxer@users.noreply.github.com> Date: Sat, 30 Dec 2023 23:11:52 +0100 Subject: [PATCH] Switch to min --- .../java/org/matsim/contrib/drt/optimizer/depot/Depots.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/contribs/drt/src/main/java/org/matsim/contrib/drt/optimizer/depot/Depots.java b/contribs/drt/src/main/java/org/matsim/contrib/drt/optimizer/depot/Depots.java index e074587134b..0d35c029215 100644 --- a/contribs/drt/src/main/java/org/matsim/contrib/drt/optimizer/depot/Depots.java +++ b/contribs/drt/src/main/java/org/matsim/contrib/drt/optimizer/depot/Depots.java @@ -69,9 +69,9 @@ public static Link findStraightLineNearestDepot(DvrpVehicle vehicle, Set 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) {}