
- Java BeanUtils Tutorial
- Java BeanUtils - Home
- Java BeanUtils - Overview
- Standard JavaBeans
- Background
- Basic Property Access
- Nested Property Access
- Customizing Introspection
- Suppressing Properties
- Dynamic Beans (DynaBeans)
- Background
- Basic DynaBeans
- ResultSetDynaClass
- RowSetDynaClass
- WrapDynaBean
- Lazy DynaBeans
- Data Type Conversions
- Background
- BeanUtils and ConvertUtils
- Create Custom Converters
- Locale Aware Conversions
- Utility Objects & Classes
- Utility Objects & Classes
- Collections
- Comparing Beans
- Operating On Collections
- Querying Or Filtering Collections
- Transforming Collections
- Java BeanUtils Useful Resources
- Java BeanUtils - Quick Guide
- Java BeanUtils - Resources
- Java BeanUtils - Discussion
Java BeanUtils - Operating On Collections
Description
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 );
Advertisements