public String addFlightToCart(long bookingId) { List<Booking> flights = bookingFlowModelBean.getFlights(); for (Booking flight : flights) { if (flight.getBookingId() == bookingId) { bookingFlowModelBean.getCartBookings().add(flight); break; } } return "cart"; }
public void removeBooking(long bookingId) { List<Booking> cartBookings = bookingFlowModelBean.getCartBookings(); Booking bookingToRemove = null; for (Booking cartBooking : cartBookings) { if (cartBooking.getBookingId() == bookingId) { bookingToRemove = cartBooking; break; } } if (bookingToRemove != null) { cartBookings.remove(bookingToRemove); } }