// find outbound leg
for (FlightInfo flight : flights) {
if ((flight.getFromLocation().equals(tripLeg.getFromLocation())) && (flight.getToLocation().equals(tripLeg
.getToLocation()))
&& (flight.getFromDate().equals(tripLeg.getFromDate()))) {
TripItem item =
new TripItem("", "", TripItem.FLIGHT, flight.getName(), flight.getDescription(), flight
.getFromLocation() + " - "
+ flight.getToLocation(), flight.getFromDate(), flight.getToDate(), flight.getPricePerSeat(),
flight.getCurrency(), flight.getLink());
items.add(item);
}
}
// find return leg
for (FlightInfo flight : flights) {
if ((flight.getFromLocation().equals(tripLeg.getToLocation())) && (flight.getToLocation().equals(tripLeg
.getFromLocation()))
&& (flight.getFromDate().equals(tripLeg.getToDate()))) {
TripItem item =
new TripItem("", "", TripItem.FLIGHT, flight.getName(), flight.getDescription(), flight
.getFromLocation() + " - "
+ flight.getToLocation(), flight.getFromDate(), tripLeg.getToDate(), flight.getPricePerSeat(),
flight.getCurrency(), flight.getLink());
items.add(item);
}