The following is what my List looks like, it is a web service call that pulls Itinerary data from an external source. There are two passengers for this specific call and I don't need both of their information because its the same flight, how can I remove this extra data?
Test Flight(
ItineraryFlights:[accountCompanions=(), active=true, airline=Delta, arrival=2013-10-12T15:38:00, confirmationNumber=1234565, departure=2013-10-12T12:05:00 , flightNumber=15161, fromAirport=Atlanta, itinerary=null, itineraryDay=2013-10-12T12:05:00,
itineraryFlightID=3492, status=Active, success=true, toAirport=San Juan],
ItineraryFlights:[accountCompanions=(), active=true, airline=Delta, arrival=2013-10-12T15:38:00, confirmationNumber=1234565, departure=2013-10-12T12:05:00 , flightNumber=15160,
fromAirport=Atlanta, itinerary=null, itineraryDay=2013-10-12T12:05:00, itineraryFlightID=3493, status=Active, success=true, toAirport=San Juan],
ItineraryFlights:[accountCompanions=(), active=true, airline=Delta, arrival=2013-10-12T15:38:00,
confirmationNumber=1234565, departure=2013-10-12T12:05:00 , flightNumber=15161, fromAirport=Atlanta, itinerary=null, itineraryDay=2013-10-12T12:05:00, itineraryFlightID=3494, status=Active, success=true, toAirport=San Juan],
ItineraryFlights:[accountCompanions=(),
active=true, airline=Delta, arrival=2013-10-12T15:38:00, confirmationNumber=1234565, departure=2013-10-12T12:05:00 , flightNumber=15160, fromAirport=Atlanta, itinerary=null, itineraryDay=2013-10-12T12:05:00, itineraryFlightID=3495, status=Active, success=true,
toAirport=San Juan])
By concatenation of the airline and flight number you can find the dupes and assume all the data underneath it is similar and can be removed. This is what I was thinking for my logic, but I'm unsure now. Am I making this too complicated?
private static List<ServiceBusServices.ItineraryFlights> getFlightInfo(String dryFlyID)
{
intineraryFlights = TripProfileProxy.retreiveFlightInformation(dryFlyID);
Diagnostics.debug('intineraryFlights' + intineraryFlights);
Integer count = -1;
String concat;
String airlines;
String flightNumber;
for(ServiceBusServices.ItineraryFlights intinF : intineraryFlights)
{
if(count < 0)
{
airlines = intinF.airline;
flightNumber = intinF.flightNumber;
concat = airlines + ' ' + flightNumber;
}
if(intinF.airline + ' ' + intinF.flightNumber == concat)
{
intineraryFlights.remove(not sure what do.);
count + 1;
}
}
return intineraryFlights;
}