Created
March 9, 2018 11:52
-
-
Save artem-v/43e9b24e2a8e534a616068cad27ea8b6 to your computer and use it in GitHub Desktop.
SortedIteratorTest.java
This file contains 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
import org.junit.Test; | |
import java.util.ArrayList; | |
import java.util.Iterator; | |
import java.util.stream.IntStream; | |
public class SortedIteratorTest { | |
@Test | |
public void test1() { | |
Iterator<Integer> i1 = IntStream.rangeClosed(1, 3).iterator(); | |
Iterator<Integer> i2 = IntStream.rangeClosed(2, 5).iterator(); | |
Iterator<Integer> i3 = IntStream.rangeClosed(4, 8).iterator(); | |
ArrayList<Iterator<Integer>> list = new ArrayList<>(); | |
list.add(i1); | |
list.add(i2); | |
list.add(i3); | |
Iterator<Integer> target = new SortedIterator<>(list); | |
while (target.hasNext()) { | |
System.out.println(target.next()); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment