commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "James Strachan" <>
Subject Re: [collections] - Few more collections for the masses... (impor tant for Struts view objects, maybe other projects)
Date Fri, 17 May 2002 17:14:10 GMT
I don't claim to have fully grokked the reason for the Reserve* collections
yet but shouldn't they take a Factory object instead of a Class instance and
array of argument types and an array of argument instances? Something along
these lines...

public interface Factory {
    Object createObject();

It'd make them a bit more reusable. Passing in a Class and argument
types/instances arrays seems a bit of a special case of how to create new
object instances. Also folks might want to handle exceptions differently -
making the construction pluggable might make sense.

Also are these collections 'lazy'?  i.e. is their point to lazily construct
elements as they are asked for, on demand, in the same way as the lazy
initialization pattern for bean properties? Maybe calling them lazy might be
better then?


List list = LazyUtils.lazyList( new ArrayList(), new MyFactory() );

which follows the pattern set by PredicateUtils and its factory methods for
each type of collection

----- Original Message -----
From: "Arron Bates" <>
To: "Jakarta Commons Developers List" <>
Sent: Friday, May 17, 2002 5:49 PM
Subject: Re: [collections] - Few more collections for the masses... (impor
tant for Struts view objects, maybe other projects)

> 1) What 8 interfaces?... There's only 2 that are valid.
> 2) They're currently small and simple. I don't see a need to
> 3&4) I'll get onto subList, but I don't fully agree that the rest
> (Iterators) are relevant. For example, you want an Iterator when you
> want to run over what is there, not what is "expected" to be there,
> which is what these are for.
> These collections are for when a system has a collection, and expects
> objects to be at various places, they will be provided, or created and
> provided where needed. But an Iterator is just "I want something
> depicting the whole collection".
> Arron.
> Jack, Paul wrote:
> >>Obviously, list and map implementations respectively...
> >>
> >>
> >>
> >
> >Haven't looked in-depth at the code, but a few thoughts already:
> >
> >1.  I'd like to see implementations for all eight collection
> >interfaces.
> >
> >2.  I'd like those implementations to be generated from one class
> >that uses static factory methods to construct the Reserve
> >wrappers, as per the Collections.synchronized* methods.
> >
> >3.  From the implementation of ReserveList, it doesn't appear
> >that sublists inherit the reserve behavior; an index accessed
> >via a sublist won't ever invoke the createObject method.
> >
> >4.  Similar to #3, but for iterators.
> >
> >-Paul
> >
> >--
> >To unsubscribe, e-mail:
> >For additional commands, e-mail:
> >
> --
> To unsubscribe, e-mail:
> For additional commands, e-mail:

Do You Yahoo!?
Get your free address at

To unsubscribe, e-mail:   <>
For additional commands, e-mail: <>

View raw message