code: public boolean isLastLeg(RouteProgress routeProgress) {
      List<RouteLeg> legs = routeProgress.directionsRoute().legs();
      RouteLeg currentLeg = routeProgress.currentLeg();
      return currentLeg.equals(legs.get(legs.size() - 1));
    }
docs: Looks at the current {@link RouteProgress} list of legs and
  checks if the current leg is the last leg.
  
  @param routeProgress the current route progress
  @return true if last leg, false if not
  @since 0.8.0