On 05/27/2015 06:52 PM, Gary Gregory wrote: > Let's not reinvent the wheel indeed.
This is not about reinventing the wheel or reimplementing Java 8 streams. The rationale is to glue together existing functionality in collections by a fluent API, very much the same as already exists in guava or other libraries (see Seq in https://github.com/jOOQ/jOOL). Just to give you an example: we had a feature request to override some method in CollectionUtils to perform filtering a collection and transforming the result in one go. This can also be done like that in collections: Collection<String> result = CollectionUtils.collect( IteratorUtils.filteredIterator(coll.iterator(), predicate), transformer ); which is a bit inconvenient to write, and one has to know the available iterators to avoid intermediate results being created (which would be the case when naively using collect(select(coll, predicate), transformer). The proposed FluentIterable just simplifies this and similar use-cases. Furthermore, a FluentIterable operates on an Iterable, as the name implies, which has the advantage over streams that it can be re-used, as it really just provides a view of an Iterable. Note: the API also provides a way to evaluate a fluent iterable and create a new iterable based on the results. That way one can decouple the view from the source. And let's not forget that collections still targets Java 6. Thomas --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@commons.apache.org For additional commands, e-mail: dev-h...@commons.apache.org