commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Stephen Colebourne" <scolebou...@btopenworld.com>
Subject [collections] Primitive collections
Date Mon, 14 Oct 2002 20:34:14 GMT
A debate has recently arrived at my doors privately from Bruce Eckel related
to the primitive collections:

Bruce has argued that the primitive method names should be the same as the
Object ones from List, and the primitive classes should thus not implement
List but a new interface PrimitiveIntList etc.

Due to the current freeze on [collections] for release and need for a
release, I (as release manager) have decided to restrict debate on this and
proceed with the primitive collections as is.

Any objections??

Stephen


Original debate:
----- Original Message -----
From: "Bruce Eckel" <Bruce@EckelObjects.com>
> I think you should implement a parallel interface hierarchy:
> PrimitiveCollection, PrimitiveList, PrimitiveSet, PrimitiveMap. I
> think it's a lot more important to have the same method names as
> the Java collection hierarchy.
>
> *********** REPLY SEPARATOR  ***********
>
> On 10/14/2002 at 5:46 PM scolebourne@btopenworld.com wrote:
>
> >The reason for the method names is that the classes implement the
> List
> >interface (returning Integer objects). Clearly a different method
> name is
> >required as int and Object are incompatable types.
> >
> >At present, we have lists for most primitive types. We do not have
> Map
> >implementations however, and this will hopefully be addresed by
> someone
> >soon.
> >
> >Stephen
> >
> >>  from:    Bruce Eckel <Bruce@EckelObjects.com>
> >>
> >> Any hope for review/refactoring on these things? For example,
> the
> >> IntArrayList uses 'Int' everywhere in its method names. For
> >> example:
> >> addInt(), getInt(), containsInt(), indexOfInt(), and on.
> >> why not just follow the existing container library rather than
> >> forcing people to learn something new and redundant? e.g.:
> >> add(), get(), contains(), indexOf()
> >> If I create a container of int, then that's what I expect to
> add()
> >> and get().
> >>
> >> *********** REPLY SEPARATOR  ***********
> >>
> >> On 10/14/2002 at 8:28 AM Henri Yandell wrote:
> >>
> >> >Have a look at:
> >> >
> >>
> >http://cvs.apache.org/viewcvs.cgi/jakarta-commons/collections/src/j
>
> >> ava/org/apache/commons/collections/primitives/
> >> >
> >> >Stephen Colebourne's preparing a new release of Collections.
> >> Stephen, will
> >> >the primitives be going in that release?
> >> >
> >> >Hen
> >> >
> >> >[just caught James' reply, so will limit this going to
> everyone.
> >> The link
> >> >above is the code in cvs James mentions]
> >> >
> >> >On Mon, 14 Oct 2002, Bruce Eckel wrote:
> >> >
> >> >> As I was working on "Thinking in Java, 3rd edition" I read
> the
> >> part
> >> >> about how collections don't handle primitive types. It also
> >> appears
> >> >> that this will *not* be addressed with Generics in JDK 1.5 --
> >> that
> >> >> is, Generics will only handle objects and will not be able to
> be
> >> >> instantiated for primitives, as templates can be with C  .
> >> >>
> >> >> Have you thought about creating versions of the Collections
> for
> >> >> primitive types?



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


Mime
View raw message