public static <TK,FV>List<RichTranslation<TK,FV>> mergeAndDedup(List<RichTranslation<TK,FV>> standard,List<RichTranslation<TK,FV>> alt,int maxAltItems){
  IntSet hashCodeSet=new IntOpenHashSet(standard.size());
  for (  RichTranslation<TK,FV> s : standard) {
    hashCodeSet.add(derivationHashCode(s.getFeaturizable().derivation));
  }
  List<RichTranslation<TK,FV>> returnList=new ArrayList<>(standard);
  for (int i=0, sz=Math.min(maxAltItems,alt.size()); i < sz; ++i) {
    RichTranslation<TK,FV> t=alt.get(i);
    int hashCode=derivationHashCode(t.getFeaturizable().derivation);
    if (!hashCodeSet.contains(hashCode))     returnList.add(t);
  }
  Collections.sort(returnList);
  return returnList;
}

public static < TK , FV > List < RichTranslation < TK , FV > > mergeAndDedup ( List < RichTranslation < TK , FV > > standard , List < RichTranslation < TK , FV > > alt , int maxAltItems ) { IntSet hashCodeSet = new IntOpenHashSet ( standard . size ( ) ) ; for ( RichTranslation < TK , FV > s : standard ) { hashCodeSet . add ( derivationHashCode ( s . getFeaturizable ( ) . derivation ) ) ; } List < RichTranslation < TK , FV > > returnList = new ArrayList < > ( standard ) ; for ( int i = 0 , sz = Math . min ( maxAltItems , alt . size ( ) ) ; i < sz ; ++ i ) { RichTranslation < TK , FV > t = alt . get ( i ) ; int hashCode = derivationHashCode ( t . getFeaturizable ( ) . derivation ) ; if ( ! hashCodeSet . contains ( hashCode ) ) returnList . add ( t ) ; } Collections . sort ( returnList ) ; return returnList ; }
baseline implementation . augments the " standard " list with alternatives .
