[Logo]
Forums Register Login
Report : Java OCP 8 Programmer II Study Guide (Sybex)

Chapter: 3, Page: 136, Table 3.5

The peek() method description says "Returns next element or returns null if empty queue"
As I realized, the peek () method will Retrieves, the head of the queue, or returns null if this queue is empty. please make me correct, if I understood wrong.

Regards,
Abdulaziz Akbary

Chapter: 3, Page: 136, Table 3.5

The element() method description says "Returns next element or returns throws an exception if empty"
The peek() method description says "Returns next element or returns null if empty queue"

As I realized, the peek () method will Retrieves, the head of the queue, or returns null if the queue is empty.
The element() method Retrieves, the head of the queue.This method differs from peek because it throws an exception if the queue is empty.

The pop() and poll() will remove the head of the queue.

please make me correct, if I understood wrong.

Regards,
Abdulaziz Akbary
We used "next" colloquially. I agree this could have been clearer.
Screaming fools! It's nothing more than a tiny ad:
Download Free Java APIs to Work with Office Files and PDF
htttp://www.e-iceblue.com/free-apis.html


This thread has been viewed 299 times.

All times above are in ranch (not your local) time.
The current ranch time is
Dec 12, 2018 18:13:59.