maidh91 / guava-libraries

Automatically exported from code.google.com/p/guava-libraries
Apache License 2.0
0 stars 0 forks source link

Adding helper method in Iterables to see Iterable<Iterable<T>> as Iterable<T> #313

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Hi,

I would like to propose the addition of a method to Iterables with this
signature:

<T> Iterable<T> flatten(Iterable<Iterable<T>>)

I often use this function when I transform (in the sense of
Iterables.transform()) an Iterable<T> with a function of this kind:
Function<T, Iterable<T>>. The result is obviously an Iterable<Iterable<T>>
and the need of viewing it as a single Iterable<T> is, imho, very frequent.

I attach a sample implementation. Please let me know your opinion about this.

Best regards,
Mikael Barbero

Original issue reported on code.google.com by mikael.b...@gmail.com on 12 Jan 2010 at 8:35

Attachments:

GoogleCodeExporter commented 9 years ago
We named this Iterables.concat() because flatten() can be taken to mean that it 
flattens N levels deep.

Thanks for asking!

Original comment by kevinb@google.com on 13 Jan 2010 at 2:56

GoogleCodeExporter commented 9 years ago
This issue has been migrated to GitHub.

It can be found at https://github.com/google/guava/issues/<id>

Original comment by cgdecker@google.com on 1 Nov 2014 at 4:16

GoogleCodeExporter commented 9 years ago

Original comment by cgdecker@google.com on 3 Nov 2014 at 9:10