code: @CheckReturnValue
    public UnionWeight<W> withAppended(final UnionWeight<W> weight, final W toAppend) {
      if (isZero(weight) || weight.getWeights().isEmpty()) {
        return UnionWeight.createSingle(toAppend);
      }
      ImmutableList<W> weights = weight.getWeights();
      ImmutableList.Builder<W> builder = ImmutableList.builder();
      builder.addAll(weights.subList(0, weights.size() - 1));
      W last = weights.get(weights.size() - 1);
      int compare = ordering.compare(last, toAppend);
      Preconditions.checkState(compare <= 0, "cant call withAppend with a weight out of order", weight, toAppend);
      if (compare == 0) {
        builder.add(mergeStrategy.merge(last, toAppend));
      } else {
        // compare == -1, meaning that toAppend is greater than current end
        builder.add(last); // append existing last to builder
        builder.add(toAppend);
      }
      return makeCheckedFrom(builder.build());
    }
docs: A shortcut version of Plus that can be used when you know that you are inserting things in sorted order and you
  just want to add a (maybe new, maybe dup) element into the union set
  (This is analogous to openfst's union weight PushBack)
  
  @param weight   existing weight
  @param toAppend you know that this is either the new end or should be merged into the existing end
  @return appended weight