Skip to content

Introduction

Ciaran O'Reilly edited this page Jun 3, 2015 · 3 revisions

Introduction

A general purpose Java library, developed at SRI International's Artificial Intelligence Center and built on top of Google's guava-libraries. The library relies heavily on the notion of functions-as-objects, the most used ones being Function and Predicate. These can be passed around between methods. There is also a number of predefined classes of such functions and predicates for common tasks, such as GetFirstOfPair and Equals. The main class in the library is Util, which has a long list of static methods that mostly manipulate collections and iterators. These methods are often pretty generic and delegate specific behavior to functions-as-objects passed as arguments. Again this is very much in the functional programming spirit (see for example the Util.mapIntoList and Util.thereExists methods, among many others). It also finds some inspiration in the STL C++ library. The library also provides utilities for forming iterators easily. EZIterator can be extended with a single method definition specifying how the next element in an iterator's range is to be computed. FunctionIterator puts a unary function "on top" of a base iterator, ranging instead over the results of applying that function to the elements in the range of the base iterator. This is a better alternative to computing all these results and placing them in a collection first, and only then iterating over the results, because it is lazy; if the processing is interrupted midway, the results for subsequent objects have never had to be computed.

Main capabilities of the library can be grouped as follows: