code: static <I, S extends Iterable<I>> Object[] addTerminalToSequence(S sequence,
                                                                       SequenceTerminal<S> terminatingObject) {
  
          ArrayList<Object> list = new ArrayList<>();
          for (I item : sequence)
              list.add(item);
  
          Object[] newSequence = new Object[list.size() + 1];
  
          int i = 0;
          for (; i < list.size(); i++)
              newSequence[i] = list.get(i);
          newSequence[i] = terminatingObject;
          return newSequence;
      }
docs: Appends a SequenceTerminal element to a supplied array.
  
  @param sequence          The sequence to which we are applying the terminating object.
  @param terminatingObject The instance of the terminating object.
  @return A new sequence with an extra element at the end containing the
  terminating object.