queue add remove leemnt vs offer poll peek code example
Example: queue poll vs remove
public E remove() {
E x = poll();
if (x != null)
return x;
else
throw new NoSuchElementException();
}
public E remove() {
E x = poll();
if (x != null)
return x;
else
throw new NoSuchElementException();
}