Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public Object next(){
- q.enqueue(q.dequeue);
- q.dequeue();
- return q.examine();
- }
- public void enqueue(Object o) throws Overflow{
- if (!isFull()) {
- last++;
- items[last] = o;
- }
- else throw new Overflow("enqueing to full queue");
- }
- public Object dequeue() throws Underflow {
- if (!isEmpty()){
- Object temp = items[first];
- first++;
- return temp;
- }
- else throw new Underflow("dequeueing form empty queue");
- }
Add Comment
Please, Sign In to add comment