Skip to content

Instantly share code, notes, and snippets.

@phstudy
Forked from popcornylu/Iterables.java
Last active June 4, 2016 16:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save phstudy/50dfe92b958c70bbb4260f5532d8717c to your computer and use it in GitHub Desktop.
Save phstudy/50dfe92b958c70bbb4260f5532d8717c to your computer and use it in GitHub Desktop.
Iterable transformation
import org.apache.commons.collections4.IterableUtils;
import java.util.function.Function;
public class Iterables {
public static <F, T> Iterable<T> map(
Iterable<F> iterable,
Function<F, T> mapper) {
return IterableUtils.transformedIterable(iterable, (x) -> mapper.apply(x));
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment