Java Code Examples for com.codepoetics.protonpack.StreamUtils#mergeToList()
The following examples show how to use
com.codepoetics.protonpack.StreamUtils#mergeToList() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: StreamUtilsExample.java From tutorials with MIT License | 5 votes |
public void mergeThreeStreams() { Stream<String> streamA = Stream.of("A", "B", "C"); Stream<String> streamB = Stream.of("apple", "banana", "carrot", "date"); Stream<String> streamC = Stream.of("fritter", "split", "cake", "roll", "pastry"); Stream<List<String>> merged = StreamUtils.mergeToList(streamA, streamB, streamC); }
Example 2
Source File: StreamUtilsUnitTest.java From tutorials with MIT License | 5 votes |
@Test // givenThreeStreams_whenMerge_shouldReturnMergedStream public void givenThreeStreams_whenMerge_shouldReturnMergedStream() { Stream<String> streamA = Stream.of("A", "B", "C"); Stream<String> streamB = Stream.of("apple", "banana", "carrot", "date"); Stream<String> streamC = Stream.of("fritter", "split", "cake", "roll", "pastry"); Stream<List<String>> merged = StreamUtils.mergeToList(streamA, streamB, streamC); assertThat(merged.collect(toList()), contains(asList("A", "apple", "fritter"), asList("B", "banana", "split"), asList("C", "carrot", "cake"), asList("date", "roll"), asList("pastry"))); }