On Mon, 30 Apr 2001, James Strachan wrote:

> > From: "Craig R. McClanahan" <[EMAIL PROTECTED]>
> > > * use size() method rather than getCount() to be more Java 2
> > > collections-like
> > >
> >
> > Sounds good.  The original classes were written pre-Java2, so now would be
> > a good time to update the names (and make any other changes that improve
> > their integration with the Java2 collections classes as appropriate).
> 
> You could say that the verbs "add" and "remove" are used quite a lot in the
> Java 2 collections.
> 
> <aside>
> I saw somewhere today that the Java 2 collections are referred to as the
> Java Collection Framework or JCF which is a new one on me).
> </aside>
> 

I vaguely recall having seem the "JCF" acronym ...

> 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 ...

>
> James
> 

Craig


Reply via email to