commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Neil O'Toole <neiloto...@yahoo.com>
Subject [collections][patch] LazyList decorator default factory
Date Sat, 26 Jul 2003 22:23:22 GMT

In general, decorators should strive to provide an instantiation method
of the form #decorate( decoratee ) whenever it is possible to provide
sensible defaults for the behaviour of the decorator. The attached
patch adds a method LazyList#decorate( List ) which uses the null
factory. This is a very common case, and it's much neater to do

 List lazy = LazyList.decorate( list );

than

 List lazy = LazyList.decorate( list, FactoryUtils.nullFactory() );

In fact, I'd written my own null factory before I discovered the one in
FactoryUtils ;), so this certainly lowers the usage-barrier for
LazyList.

* It should be trivial to add equivalent support for LazyMap etc..

Neil




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