code: public static MutableFst apply(Fst fst) {
      fst.throwIfInvalid();
      MutableFst copy = MutableFst.copyFrom(fst);
      Semiring semiring = copy.getSemiring();
      ArrayList<MutableState> resultStates = initResultStates(copy, semiring);
  
      // Add a new single final
      MutableState newFinal = new MutableState(semiring.one());
      copy.addState(newFinal);
      int epsILabel = copy.getInputSymbols().get(Fst.EPS);
      int epsOLabel = copy.getOutputSymbols().get(Fst.EPS);
      for (MutableState s : resultStates) {
        // add epsilon transition from the old final to the new one
        copy.addArc(s, epsILabel, epsOLabel, newFinal, s.getFinalWeight());
        // set old state's weight to zero
        s.setFinalWeight(semiring.zero());
      }
      return copy;
    }
docs: Creates a new FST that is a copy of the existing with a new signle final state
  
  It adds a new final state with a 0.0 (Semiring's 1) final wight and connects the current final states to it using
  epsilon transitions with weight equal to the original final state's weight.
  
  @param fst the input fst -- it will not be modified
  @return a mutable fst that is a copy of the input + extended with a single final