@SuppressWarnings("unchecked") public static <T>Sequence<T> wrapEnd(Sequence<T> sequence,T endToken){
  Object[] arr=new Object[sequence.size() + 1];
  System.arraycopy(sequence.elements(),0,arr,0,sequence.size());
  arr[sequence.size()]=endToken;
  return new ArraySequence<T>(true,(T[])arr);
}

@ SuppressWarnings ( "unchecked" ) public static < T > Sequence < T > wrapEnd ( Sequence < T > sequence , T endToken ) { Object [ ] arr = new Object [ sequence . size ( ) + 1 ] ; System . arraycopy ( sequence . elements ( ) , 0 , arr , 0 , sequence . size ( ) ) ; arr [ sequence . size ( ) ] = endToken ; return new ArraySequence < T > ( true , ( T [ ] ) arr ) ; }
append an end symbol to the end of a sequence .
