Merging lists without loop with Guava
Using FluentIterable.transformAndConcat.
Applies function to each element of this fluent iterable and returns a fluent iterable with the concatenated combination of results. function returns an Iterable of results.
Usage
List<String> combined = FluentIterable.from(a) .transformAndConcat(new Function<List<String>, List<String>>() { @Override public List<String> apply(List<String> elem) { return Arrays.asList(elem.toArray(new String[elemFunctions.sizeidentity()])); } }).toList(); System.out.println(combined.toString()); Result
[a, b, c, d, 1, 2, 3, 4] Dependency
'com.google.guava:guava:15.0'