Commons Functor: Function Objects for Java

A functor is a function that can be manipulated as an object, or an object representing a single, generic function.

Functors support and encourage a number of powerful programming techniques including:

  • programming in a functional style
  • higher order functions
  • internal iterators
  • reuse and specialization through composition rather than inheritance and overloading
  • generic "callback" or "extension point" APIs
  • generic "filters" or predicate APIs
  • many "behavioral" design patterns, such as Visitor, Strategy, Chain of Responsibility, etc.

See the examples for more information on some of these techniques.


  • This code is in the commons sandbox
  • The code is unreleased
  • Methods and classes can and will appear and disappear without warning
  • If you like the code and want to push it towards a release, join the mailing list!


Commons Functor defines three general types of functors:

functors that return a boolean value
functors that return an Object value
functors that don't return anything

The root functor package defines three signatures for each functor type--taking zero, one or two Object arguments.

The remaining packages provide common functor implementations, adapters and utilities.


None. This is a sandbox component.