You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by Rodney Waldhoff <rw...@apache.org> on 2004/07/12 18:40:52 UTC

[primitives] XxxStack questions

I've been doing a little clean-up of commons-primitives in order to move 
toward a 1.1 (or better) release.

I notice that back in April several Stack implementations were introduced, 
with names like FloatStack and IntStack, etc.

I wonder if:

1) in keeping with the XxxList implementations, if XxxStack should in fact 
be an interface, rather than a concrete class

2) we might be able to get away with simply adding the stack methods 
(push/peek/pop) to the XxxList interfaces, and providing adapters to and 
from the Object based Stack, as necessary.

3) we should make XxxStack descend from XxxCollection, at minimum

Any thoughts?

- Rod

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


Re: [primitives] XxxStack questions

Posted by Stephen Colebourne <sc...@btopenworld.com>.
I would be opposed to changing any interfaces, but adding new interfaces to
represent stacks seems sensible.

I have heard arguments before (eg. Joshua Bloch, Effective Java) that Stack
should not extend List as it is an independent data structure. I'm not
completely convinced, but it may not be a bad idea here.

What if the new IntStack interface doesn't extend List?
But the implementation implements both IntStack and IntList.
And potentially the IntStack definition might contain some methods from
IntList.

That way the user could get at the List aspect if they want, but normally
they are resticted to the Stack API.

Stephen

----- Original Message -----
From: "Rodney Waldhoff" <rw...@apache.org>
> I've been doing a little clean-up of commons-primitives in order to move
> toward a 1.1 (or better) release.
>
> I notice that back in April several Stack implementations were introduced,
> with names like FloatStack and IntStack, etc.
>
> I wonder if:
>
> 1) in keeping with the XxxList implementations, if XxxStack should in fact
> be an interface, rather than a concrete class
>
> 2) we might be able to get away with simply adding the stack methods
> (push/peek/pop) to the XxxList interfaces, and providing adapters to and
> from the Object based Stack, as necessary.
>
> 3) we should make XxxStack descend from XxxCollection, at minimum
>
> Any thoughts?
>
> - Rod
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: commons-dev-help@jakarta.apache.org
>


---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org