You need to use Commons Collections because your system could benefit from the various functor interfaces and implementations provided by this component.
To use Commons Collections 3.2.1 in a Maven 2 project, add the
following dependency to your project's
pom.xml
:
Example 4.1. Adding a Dependency on Commons Collections
<dependency> <groupId>commons-collections</groupId> <artifactId>commons-collections</artifactId> <version>3.2.1</version> </dependency>
If you are not sure what this means, I'd suggest reading Maven: The Definitive
Guide. When you depend on a library in Maven 2, all you need to
do is add the dependency groupId
,
artifactId
, and version
to your
project's dependencies. Once you do this, Maven 2 will download the
dependency and make it available on your project's classpath.
Commons Collections was introduced as a series of utilities that
augment the Java Collections API. Commons Collections contains functors
such as Predicate
and Closure
, utilities for filtering and selecting
elements in a collection, and some new collections: Bag
and Buffer
. Commons Collections is as widely used
as Commons BeanUtils and Commons Lang, and with these two projects, it
forms the core of the Apache Commons components.
For more information about the Commons Collections project, see the project page at http://commons.apache.org/collections.