/** * Order is important when comparing route lists. */ public boolean equals(Object other) { if (!(other instanceof RouteList)) return false; RouteList that = (RouteList) other; if (this.size() != that.size()) return false; ListIterator<Route> it = this.listIterator(); ListIterator<Route> it1 = that.listIterator(); while (it.hasNext()) { Route route = (Route) it.next(); Route route1 = (Route) it1.next(); if (!route.equals(route1)) return false; } return true; }
/** * Gets the route set for the dialog. When acting as an User Agent Server * the route set MUST be set to the list of URIs in the Record-Route header * field from the request, taken in order and preserving all URI parameters. * When acting as an User Agent Client the route set MUST be set to the list * of URIs in the Record-Route header field from the response, taken in * reverse order and preserving all URI parameters. If no Record-Route * header field is present in the request or response, the route set MUST be * set to the empty set. This route set, even if empty, overrides any * pre-existing route set for future requests in this dialog. * <p> * Requests within a dialog MAY contain Record-Route and Contact header * fields. However, these requests do not cause the dialog's route set to be * modified. * <p> * The User Agent Client uses the remote target and route set to build the * Request-URI and Route header field of the request. * * @return an Iterator containing a list of route headers to be used for * forwarding. Empty iterator is returned if route has not been * established. */ public Iterator getRouteSet() { if (this.routeList == null) { return new LinkedList().listIterator(); } else { return this.getRouteList().listIterator(); } }
li = routeList.listIterator(); while (li.hasNext()) { Route route = (Route) li.next();