--- "Craig R. McClanahan" <[EMAIL PROTECTED]> wrote:
> > So the Queue interface might be more JCF-like if
> it were:-
> > 
> > public interface Queue {
> >     public void add(Object);
> > 
> >     // blocking remove
> >     public Object remove();
> >     public Object remove(long timeout);
> > 
> >     // non-blocking
> >     public Object removeNoWait();
> > 
> >     // peek - doesn't remove
> >     public Object get();
> > }
> > 
> > I'm less sure about the get() method. getFirst()
> would be like LinkedList?
> > Maybe leaving it as peek() is more appropriate....
> > 
> 
> I think peek() does a better job than get() at
> telling you which element
> you're going to get back.  Saying getFirst() isn't
> technically accurate on
> a LIFO queue ...

Thats fine with me. peek() does seem the most
appropriate.

So do we agree on the following?

 public interface Queue {

     public int size();

     public void add(Object);

     // blocking remove
     public Object remove();
     public Object remove(long timeout);
 
     // non-blocking
     public Object removeNoWait();
 
     // peek - doesn't remove
     public Object peek();
}


James

____________________________________________________________
Do You Yahoo!?
Get your free @yahoo.co.uk address at http://mail.yahoo.co.uk
or your free @yahoo.ie address at http://mail.yahoo.ie

Reply via email to