/ Published in: Java
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
// REMOVE: Any items that are not in the temporary list should be removed List<TravelProfilePopupDisplay> itemsToRemove = new ArrayList<TravelProfilePopupDisplay>(); for (TravelProfilePopupDisplay originalProfileDisplay : originalList) { boolean foundMatch = false; for (TravelProfilePopupDisplay tempProfileDisplay : tempTravelProfileDisplays ) { if (tempProfileDisplay.getID() == originalProfileDisplay.getID()) { foundMatch=true; } } // If the item only exists in the original list, then remove it if (foundMatch==false) { // Note: Cannot remove from originalList during iteration itemsToRemove.add( originalProfileDisplay ); } } originalList.removeAll( itemsToRemove );