@ SuppressWarnings ( "unchecked" ) public final T first ( T defaultValue ) { if ( this instanceof Callable ) { return checkedCall ( ( Callable < T > ) this ) ; } Iterator < T > it = iterator ( ) ; if ( it . hasNext ( ) ) { return it . next ( ) ; } return defaultValue ; }
Returns the first element of this sequence or the defaultValue if this sequence is empty .