LQueue - } } public boolean isEmpty(){ return(front== null)...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
Sheet1 Page 1 public class LQueue<T>{ private Node front private Node end p public LQueue(){ front = end = null } public void enqueue(T object){ if(isEmpty()){ front = end = new Node(object) } else{ end = end.next = new Node(object) } } public T dequeue(){ T temp if(isEmpty()){ throw new MyException("The Queue is empty!") } else{ temp = front.value front = front.next return temp
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Background image of page 2
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: } } public boolean isEmpty(){ return(front== null) } private class Node{ T value Node next public Node(){} public Node(T element){ value = element } } public static class MyException extends RuntimeException{ public MyException(){ super() } public MyException(String message){ super(message) } } Sheet1 Page 2 }...
View Full Document

This lab report was uploaded on 04/21/2008 for the course CSC 103 taught by Professor Franklin during the Spring '07 term at Cal Poly.

Page1 / 2

LQueue - } } public boolean isEmpty(){ return(front== null)...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online