Does not work as expected - it implements LIFO, not FIFO.
dequeue and front return inconsistent arbitrary values such as "Underflow" and "No elements in Queue", which are indistinguishable from values which could be placed in the queue.
ifs in these functions use {...} inconsistently - one uses while the other one does not, in same situation.
The comment // Functions to be implemented (and on) is just a clutter.
// returns underflow when called -> // returns the string "Underflow" when called
The data field has almost zero semantic meaning. items would be much better for example.
// front function just above the function - clutter with zero additional information, same for // isEmpty function
As whole, this class is very thin wrapper around Array, providing no additional functionality.
Low code quality. Please do not learn from this.
Does not work as expected - it implements LIFO, not FIFO.
dequeue
andfront
return inconsistent arbitrary values such as"Underflow"
and"No elements in Queue"
, which are indistinguishable from values which could be placed in the queue.if
s in these functions use{...}
inconsistently - one uses while the other one does not, in same situation.The comment
// Functions to be implemented
(and on) is just a clutter.// returns underflow when called
->// returns the string "Underflow" when called
The
data
field has almost zero semantic meaning.items
would be much better for example.// front function
just above the function - clutter with zero additional information, same for// isEmpty function
As whole, this class is very thin wrapper around Array, providing no additional functionality.
That's my main concern. It's pretty bad situation.