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;
}

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 ; }
remove items from history based on passed collection . any item not found in in the collection will be removed
