public E poll(){
  if (isEmpty()) {
    return null;
  }
  E result=elements[0];
  removeAt(0);
  return result;
}

public E poll ( ) { if ( isEmpty ( ) ) { return null ; } E result = elements [ 0 ] ; removeAt ( 0 ) ; return result ; }
gets and removes the head of the queue .
