question: public void cleanHistory ( Collection < Peer > availablePeers ) { log . debug ( "cleaning history" ) ; List < String > newPeerAddresses = new ArrayList < > ( ) ; if ( availablePeers != null ) { for ( Peer peer : availablePeers ) { if ( peer != null && peer . address != null ) { newPeerAddresses . add ( peer . address ) ; } } } List < ExchangeHistoryItem > updatedHistory = new ArrayList < > ( ) ; for ( ExchangeHistoryItem peer : history ) { if ( newPeerAddresses . contains ( peer . address ) ) { updatedHistory . add ( peer ) ; } } history = updatedHistory ; }
target:  Remove items from history based on passed collection. Any item not found in in the collection will be removed