Is there any utility which could allow us to zip two collections in Guava?
--
guava-...@googlegroups.com
Project site: https://github.com/google/guava
This group: http://groups.google.com/group/guava-discuss
This list is for general discussion.
To report an issue: https://github.com/google/guava/issues/new
To get help: http://stackoverflow.com/questions/ask?tags=guava
---
You received this message because you are subscribed to the Google Groups "guava-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to guava-discus...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/guava-discuss/a2f05a7a-24e6-421e-9376-5eabcbb772da%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
To view this discussion on the web visit https://groups.google.com/d/msgid/guava-discuss/CAORw%3DcOq5HQDfvvKaD_XQuWNpq-A%3D0FmMDzL%3Djg7uXEVuV%2BJOg%40mail.gmail.com.
Guava 21 introduced Streams.zip, which takes a Stream<A> and a Stream<B> and a BiFunction<? super A,? super B,R> which gives you a Stream<R>. If you have Collections, you could stream both of them, and if you need a Collection back rather than a Stream you could collect it, say using toImmutableList. (The problem with doing this directly in Collections is that there's no good return type since Guava has no Tuple types. It's better for your code, via the BiFunction, to state how the elements ought to be combined.)Pete.
On Mon, 3 Apr 2017 at 15:34 Olivier Grégoire <ogre...@gmail.com> wrote:
Regards,Olivier
Le lun. 3 avr. 2017 à 16:27, <dtiw...@gmail.com> a écrit :
Is there any utility which could allow us to zip two collections in Guava?--
guava-...@googlegroups.com
Project site: https://github.com/google/guava
This group: http://groups.google.com/group/guava-discuss
This list is for general discussion.
To report an issue: https://github.com/google/guava/issues/new
To get help: http://stackoverflow.com/questions/ask?tags=guava
---
You received this message because you are subscribed to the Google Groups "guava-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to guava-discuss+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/guava-discuss/a2f05a7a-24e6-421e-9376-5eabcbb772da%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
--
guava-...@googlegroups.com
Project site: https://github.com/google/guava
This group: http://groups.google.com/group/guava-discuss
This list is for general discussion.
To report an issue: https://github.com/google/guava/issues/new
To get help: http://stackoverflow.com/questions/ask?tags=guava
---
You received this message because you are subscribed to the Google Groups "guava-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to guava-discuss+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/guava-discuss/CAORw%3DcOq5HQDfvvKaD_XQuWNpq-A%3D0FmMDzL%3Djg7uXEVuV%2BJOg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
--
guava-...@googlegroups.com
Project site: https://github.com/google/guava
This group: http://groups.google.com/group/guava-discuss
This list is for general discussion.
To report an issue: https://github.com/google/guava/issues/new
To get help: http://stackoverflow.com/questions/ask?tags=guava
---
You received this message because you are subscribed to the Google Groups "guava-discuss" group.
To view this discussion on the web visit https://groups.google.com/d/msgid/guava-discuss/CAOSPF%2Be7txTVBN8m-7w50LyE-KFgxMWyBPdu%3DBh%3DdDoYHk2mFA%40mail.gmail.com.To unsubscribe from this group and stop receiving emails from it, send an email to guava-discuss+unsubscribe@googlegroups.com.