commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Stephen Colebourne" <scolebou...@btopenworld.com>
Subject [primitives] Proposed interface changes
Date Sat, 18 Oct 2003 09:54:04 GMT
I would like to propose the following changes for the primitives code as we
establish it:

New interface Collectable (better names?). Superinterface of XxxCollection
and XxxMap
- size()
- clear()
- isEmpty()
There are so many times that I've needed a shared interface between
Collection and Map
- clone()
Fix a JDK error
- isModifiable()
This would be nice to know
- optimize()
For example, implemented as a trimToSize

New interface PCollection (or PrimitiveCollection):
- toCollection()
It should be really easy to get a JDK collection from a [primitives] one.

New methods on IntCollection (et al):
- addAll(int[])
- removeAll(int[])
- containsAll(int[])
Primitive handling is often done with arrays at present, so provide good
integration
- toArray(int[], int)
Offers a way to get the primitives into a specific index in an existing
array.

New interface PList (or PrimitiveList):
- toList()
It should be really easy to get a JDK collection from a [primitives] one.
- removeRange(int, int)
Although possible via subList(), this is quicker and more obvious

New methods on IntList (et al):
- first()
- last()
Because list.get(list.size() - 1) is a pain
- indexOf(int, int)
- lastIndexOf(int, int)
Completes the set of index methods as per String
- addAll(int, int[])
Primitive handling is often done with arrays at present, so provide good
integration


IMO, these represent a balanced extension to the JDK collection design to
fit well in the primitives problem space. Opinions welcome.

Stephen



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


Mime
View raw message