private void noteDuplicate(int pos1,int pos2){
  Name n=names[pos1];
  assert (n == names[pos2]);
  assert (originalNames[pos1] != null);
  assert (originalNames[pos2] == null || originalNames[pos2] == n);
  if (dups == null) {
    dups=new ArrayList<>();
  }
  dups.add(n);
}

private void noteDuplicate ( int pos1 , int pos2 ) { Name n = names [ pos1 ] ; assert ( n == names [ pos2 ] ) ; assert ( originalNames [ pos1 ] != null ) ; assert ( originalNames [ pos2 ] == null || originalNames [ pos2 ] == n ) ; if ( dups == null ) { dups = new ArrayList < > ( ) ; } dups . add ( n ) ; }
we have just overwritten the name at pos1 with the name at pos2 . this means that there are two copies of the name , which we will have to fix later .
