Guava FluentIterable

Guava FluentIterable is part of the Guava collections library. It has great similarity to the Java 8 stream API.

This code filters a list with FluentIterable:

from(cities).filter(city -> city.contains(“e”)).transform(city -> “‘”+city + “‘”).limit(2).join(on(” “));

And this one produces the same result with Java 8 stream API: -> city.contains(“e”)).map( city ->”‘”+city+”‘”).limit(2).collect(joining(” “));

Full code is available here.

FluentIterable should be considered as useful if you still work with JDK 7 , and you want functional programming.

This blog is also available in