commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "TREPANIER, ERIC" <eric.trepan...@cgi.com>
Subject Re: [COLLECTIONS] Some more lobbying for the OrderedSet class
Date Wed, 30 Apr 2003 01:51:37 GMT
On 03-04-29 16:57, "Christopher (siege)  OBrien" <siege@preoccupied.net>
wrote:

> 
> I believe you're looking for a LinkedHashSet. You'll need to implement
> your own name-searching methods of course, but that's no longer abstract
> enough for a general-purpose collection, really.
> 
> - Chris

Well the LinkedHashSet is a J2SE 1.4 class, so I cannot use it as I am
targeting the 1.3.1 J2SE.

It is however quite similar to the Commons Collections' SequencedHashMap
class (this one I could use), but neither class does provides the direct
indexing methods associated with the List interface such as: add(index,
element), addAll(index, element), indexOf(element), remove(index), etc.
Without these, I cannot arbitrarily reorder the collection at a later time
like I could do with a List.

A scenario I have is that objects are created and added to this collection
as part of a set of Digester rules while parsing elements in an XML config
file.

The iteration of these elements must correspond (based on external criteria)
to an order that might be different from the order in which they were
initially created/appended by the Digester (which requires reordering the
collection). Also, I need to be able to refer to any individual element by
its name.

I have achieved that goal but I do realize that my implementation is not
quite as general-purpose as I would like it to be. If anybody would like to
discuss this with me (either on or off the list) I would really welcome the
feedback.

Oh well, I would really like to make a contribution to some Jakarta project
but I guess I will have to find something even more generic...

-- 
Éric Trépanier



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