@ SuppressWarnings ( "unchecked" ) public final T last ( ) { if ( this instanceof Callable ) { return checkedCall ( ( Callable < T > ) this ) ; } Iterator < T > it = iterator ( ) ; if ( ! it . hasNext ( ) ) { throw new NoSuchElementException ( ) ; } for ( ; ; ) { T t = it . next ( ) ; if ( ! it . hasNext ( ) ) { return t ; } } }
Returns the last element of this sequence .