public void log(S retained,S discarded){
  if (discarded == null)   return;
  List<S> retainedList=historyMap.get(retained);
  if (retainedList == null) {
    retainedList=new ArrayList<>();
    historyMap.put(retained,retainedList);
  }
  List<S> discardedList=historyMap.getOrDefault(discarded,Collections.emptyList());
  historyMap.remove(discarded);
  retainedList.addAll(discardedList);
  retainedList.add(discarded);
}

public void log ( S retained , S discarded ) { if ( discarded == null ) return ; List < S > retainedList = historyMap . get ( retained ) ; if ( retainedList == null ) { retainedList = new ArrayList < > ( ) ; historyMap . put ( retained , retainedList ) ; } List < S > discardedList = historyMap . getOrDefault ( discarded , Collections . emptyList ( ) ) ; historyMap . remove ( discarded ) ; retainedList . addAll ( discardedList ) ; retainedList . add ( discarded ) ; }
log a recombination decision .
