View Single Post
  #12 (permalink)  
Old 05-10-2008, 12:02 PM
ayoood ayoood is offline
Member
 
Join Date: May 2008
Posts: 39
ayoood is on a distinguished road
hi
i have this programme i don’t know why does not work with me

class Queue<T> {
private LinkedList<T> items = new LinkedList<T>();
public void enqueue(T item) {
items.addLast(item);
}
public T dequeue() {
return items.removeFirst();
}
public boolean isEmpty() {
return (items.size() == 0);
}
public void addAll(Collection<? extends T> collection) {
// Add all the items from the collection to the end of the queue
for ( T item : collection )
enqueue(item);
}
}

Last edited by ayoood : 05-12-2008 at 11:03 AM.
Reply With Quote