compareToForkingRoute
Compares this route to a forking route and returns the differences between the two.
A forking route is defined as one that branches off from this route at a designated fork point, with both routes following the same trajectory up to that point and sharing the same destination.
For instance, this method can be applied on the alternative route against the one currently being navigated:
val result = currentRoute.compareToForkingRoute(betterAlternativeRoute)
result.ifSuccess { differences ->
// Analyze the differences
}
}The returned RouteDifferences object can provide insights into the advantages and disadvantages of the alternative route.
Receiver
The route to compare with the forking route.
Return
A Result containing RouteDifferences, or a RouteComparisonFailure if the comparison fails:
RouteComparisonFailure.SameRoute if the routes have the same route ID.
RouteComparisonFailure.DifferentDestinations if the routes have different destinations.
RouteComparisonFailure.ForkPointsNotFound if the fork points are not found in one or both of the routes.
Parameters
The route to compare with the receiver route.