Matt Blum wrote:
The proposed CollectionUtils method is currently called cloneCollection, but
could be called deepClone. It takes any Collection as a parameter, and
attempts to create a clone of it and every object contained within it. It
tries a couple of different processes to do this, starting with using
reflection to find the objects' clone method; if they don't have such a
method but are Serializable, it uses Commons Lang SerializationUtils' clone
method to clone them. If it can't do that, either, it will just copy by
reference. It will recursively iterate through any sub-Collections as well,
meaning that circular references will cause it to generate a stack
overflow. I've found it to be very useful.
This could be useful, but would need to be done without a dependency on
commons-lang. Practically, it could just be the application of a
Transformer to each element in the collection resulting in a new collection.
The main proposed ListUtils method is simply called move, and takes a List,
an index, and a distance as parameters. It will move the element in the
List at the specified index the specified distance, which can either be
positive or negative. It will wrap around, so that, in a List of length
three (say), moving an element a distance of -2 would have the same effect
as moving it 1. It will throw IndexOutOfBoundsException, as you'd expect,
if the specified index is out of range.
This seems a little specialised, although I'm open to other views.
I have another proposed ListUtils method, called removeNulls, which as you'd
expect simply removes nulls from a list.
I have coded this before and it is useful.
If you would like to write a patch, perhaps for the null remove first,
then follow http://jakarta.apache.org/commons/patches.html
creating a bugzilla request prefixed by [collections]
Stephen
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]