RibDelta: remove old todos; collapse identical actions
@@ -182,8 +182,10 @@ public final class RibDelta<R> {
ImmutableMap.toImmutableMap(
Entry::getKey,
e ->
- // TODO: convert to set after all route types properly implement equality
- ImmutableList.copyOf(e.getValue().values()))));
+ // Iteration order is predictable here
+ e.getValue().values().stream()
+ .distinct() // Collapse any duplicate actions
+ .collect(ImmutableList.toImmutableList()))));
}
/** Process all added and removed routes from a given delta */
@@ -289,9 +291,8 @@ public final class RibDelta<R> {
.forEach(
(prefix, actions) ->
actions.stream()
- // TODO: uncomment after all route types properly implement equality
- // .distinct()
- .forEachOrdered(
+ .distinct()
+ .forEach(
uRouteAdvertisement -> {
T tRoute = converter.apply(uRouteAdvertisement.getRoute());
if (uRouteAdvertisement.isWithdrawn()) {
