Java BeanUtils - Operating On Collections
The Commons-Collections are build upon interfaces, implementations and utilities. It contains Closure interface in the code that can be applied on the arbitrary input object and code permits to apply Closures to contents of collection. There is Closure called BeanPropertyValueChangeClosure sets specified property to specified value. This value can be combined with commons-collections in which all the beans will have specified property to specified value in the collection.
For instance, you can set the myCar property to TRUE for entire collection as shown below:
//creating the closure BeanPropertyValueChangeClosure closure = new BeanPropertyValueChangeClosure( "myCar", Boolean.TRUE ); //updating the Collection CollectionUtils.forAllDo( myCollection, closure );