0

Can someone explain the code below? Is .next an operator in java that pushes the pointer to the next node in the linked list?
Node E < -- type node?

public E dequeue ( ) throws EmptyQueueException {
 if (isEmpty ( )) {
 throw new EmptyQueueException (”Queue under flow”) ;
 else{
 if (end==front.next) // Special case , dequeue single element in queue
 end = front;
 E val = front.next.element;
 front.next = front.next.next; / / Bypass first node
 return(val);
 }
 }

`

3
Contributors
3
Replies
4
Views
5 Years
Discussion Span
Last Post by warpstar
0

Next isn't likely an operator or method. I believe its just a member variable with a reference to the next Element

0

SKy is right,next is not a method or operator,it is just a member variable.Can you provide the complete code so as more information can be provided on it's working...

0

i'll paste the code shortly, but if you say it is a variable which contain references to the next node in the list.

How does it get populated? its kind of confusing as to how the code works, I know how Linked lists work in general,

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.