Created
November 2, 2014 21:31
-
-
Save vfarcic/4573f452a1ebb25911d9 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.technologyconversations.java8exercises.streams; | |
import org.junit.Test; | |
import java.util.List; | |
import static com.technologyconversations.java8exercises.streams.FlatCollection.*; | |
import static java.util.Arrays.asList; | |
import static org.assertj.core.api.Assertions.assertThat; | |
/* | |
Flatten multidimensional collection | |
*/ | |
public class FlatCollectionSpec { | |
@Test | |
public void transformShouldFlattenCollection() { | |
List<List<String>> collection = asList(asList("Viktor", "Farcic"), asList("John", "Doe", "Third")); | |
List<String> expected = asList("Viktor", "Farcic", "John", "Doe", "Third"); | |
assertThat(transform(collection)).hasSameElementsAs(expected); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment