I must comment that a subset of this API is available as a FluentIterable class in the unreleased [functor] component. Having said that, the proposed additions look good to me.
Matt On Wed, May 27, 2015 at 2:45 PM, Oliver Heger <oliver.he...@oliver-heger.de> wrote: > > > Am 27.05.2015 um 20:37 schrieb Thomas Neidhart: >> 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. > > If the major part of the functionality is already there and thus the > implementation effort is reasonably low, I am very much in favor of the > proposed API. It makes the good old [collections] API really more sexy! > > Oliver > >> >> Thomas >> >> --------------------------------------------------------------------- >> To unsubscribe, e-mail: dev-unsubscr...@commons.apache.org >> For additional commands, e-mail: dev-h...@commons.apache.org >> > > --------------------------------------------------------------------- > To unsubscribe, e-mail: dev-unsubscr...@commons.apache.org > For additional commands, e-mail: dev-h...@commons.apache.org > --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@commons.apache.org For additional commands, e-mail: dev-h...@commons.apache.org