commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "James Carman" <>
Subject RE: [collections] New methods
Date Mon, 03 Jul 2006 16:31:28 GMT
You can't do a resize method because the code won't know which way you want
to go with it.  For instance, if you ask it to resize(list, 10) and the list
has 20 elements in it, does that mean that you want it to trim it back so
that it only contains 10 elements?  Or, does that mean that it's okay,
because it already has at least 10 elements in it?  So, I'm cool with having
two methods here.  One for shrinking and one for growing (if necessary).

+1 on not needing the ListUtils.copy() method, since the core API provides

+1 on the obscurity of the merge() method.  That doesn't sound like a common
enough requirement to be on commons collections.

-----Original Message-----
From: Henri Yandell [] 
Sent: Monday, July 03, 2006 12:13 PM
To: Jakarta Commons Developers List
Subject: Re: [collections] New methods

On 7/3/06, Stephen Colebourne <> wrote:
> Some possible new methods for [collections]
> ListUtils.trimSize(List list, int size)
> - trims list size to size if too large
> ListUtils.forceSize(List list, int size)
> - trims list size to size if too large
> - adds extra nulls to the list if its too small

Would it be bad to just have the one method that both enlarged and
shrunk?  resize(LIst, int) or something?

> ListUtils.copy(List,Object[])
> - copy a collection into an array

java.util.Collection.toArray() ?

> ListUtils.merge(List list, List defaultValues)
> - replace any null values in list with the matching index in defaultValues

Do you think this is something people will need often? Seems likely to
be quite rare.


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

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

View raw message