I am interested in using functors (function objects) in Java. With quick googling I found these 3 packages:
and of 3, JGA seemed like it might have the best design. But I suspect others here who have actually used one or more of the packages might be able to offer more insight as to pros and cons of these (and perhaps other) functor packages.
Provides interfaces for 0, 1, and 2 argument functions. Uses Java generics. Good range of algorithms for working with functions.
Provides classes for 0, 1, 2 and arbitrary number of argument functions. Domain objects subclass these. Uses Java generics. Extensive range of algorithms. Includes JFXG (Java Functor eXpression Grammar) - a parsed language intended to make it easy to create arbitrarily complex functors. Provides multiple algorithms for working with functions.
Provides interfaces for 0, 1, and 2 argument functions as well as 0, 1 and 2 argument procedures (which return no value). Uses Java generics. Good range of algorithms.
Provides Function and Predicate interfaces for single argument functions. Uses Java generics. Provides only the compose method for combining functions. Pretty basic.
Provides interfaces and classes for 0, 1, 2 and arbitrary number of argument functions. Uses Java generics. Existing methods can be turned into functions via the provided function reflection classes.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With