Fix generics in IteratorChain.IteratorChain(Collection)
This commit is contained in:
parent
2d8ad42bde
commit
99f65a305e
|
@ -38,6 +38,7 @@
|
||||||
<action type="fix" dev="ggregory" due-to="Gary Gregory, Alex Herbert">BloomFilterExtractor.flatten() should throw an exception instead of returning null.</action>
|
<action type="fix" dev="ggregory" due-to="Gary Gregory, Alex Herbert">BloomFilterExtractor.flatten() should throw an exception instead of returning null.</action>
|
||||||
<action type="fix" dev="ggregory" due-to="Gary Gregory, Claude Warren">Improve WrappedBloomFilterTest. All tests now assert copy() the same way.</action>
|
<action type="fix" dev="ggregory" due-to="Gary Gregory, Claude Warren">Improve WrappedBloomFilterTest. All tests now assert copy() the same way.</action>
|
||||||
<action type="fix" dev="ggregory" due-to="Gary Gregory, Daniele" issue="COLLECTIONS-860">Javadoc CollectionBag.add* to throw ClassCastException.</action>
|
<action type="fix" dev="ggregory" due-to="Gary Gregory, Daniele" issue="COLLECTIONS-860">Javadoc CollectionBag.add* to throw ClassCastException.</action>
|
||||||
|
<action type="fix" dev="ggregory" due-to="Gary Gregory">Fix generics in IteratorChain.IteratorChain(Collection).</action>
|
||||||
<!-- ADD -->
|
<!-- ADD -->
|
||||||
<action type="add" dev="ggregory" due-to="Gary Gregory">LayerManager.Builder implements Supplier.</action>
|
<action type="add" dev="ggregory" due-to="Gary Gregory">LayerManager.Builder implements Supplier.</action>
|
||||||
<action type="add" dev="ggregory" due-to="Gary Gregory, hemanth0525">Add CollectionUtils.duplicateList(Collection).</action>
|
<action type="add" dev="ggregory" due-to="Gary Gregory, hemanth0525">Add CollectionUtils.duplicateList(Collection).</action>
|
||||||
|
|
|
@ -97,7 +97,7 @@ public class IteratorChain<E> implements Iterator<E> {
|
||||||
* @throws ClassCastException if iterators collection doesn't contain an
|
* @throws ClassCastException if iterators collection doesn't contain an
|
||||||
* iterator
|
* iterator
|
||||||
*/
|
*/
|
||||||
public IteratorChain(final Collection<Iterator<? extends E>> iteratorChain) {
|
public IteratorChain(final Collection<? extends Iterator<? extends E>> iteratorChain) {
|
||||||
for (final Iterator<? extends E> iterator : iteratorChain) {
|
for (final Iterator<? extends E> iterator : iteratorChain) {
|
||||||
addIterator(iterator);
|
addIterator(iterator);
|
||||||
}
|
}
|
||||||
|
|
|
@ -137,6 +137,21 @@ public class IteratorChainTest extends AbstractIteratorTest<String> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testConstructList() {
|
||||||
|
final List<Iterator<String>> list = new ArrayList<>();
|
||||||
|
list.add(list1.iterator());
|
||||||
|
list.add(list2.iterator());
|
||||||
|
list.add(list3.iterator());
|
||||||
|
final List<String> expected = new ArrayList<>(list1);
|
||||||
|
expected.addAll(list2);
|
||||||
|
expected.addAll(list3);
|
||||||
|
final IteratorChain<String> iter = new IteratorChain<>(list);
|
||||||
|
final List<String> actual = new ArrayList<>();
|
||||||
|
iter.forEachRemaining(actual::add);
|
||||||
|
assertEquals(actual, expected);
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@Override
|
@Override
|
||||||
public void testRemove() {
|
public void testRemove() {
|
||||||
|
|
Loading…
Reference in New Issue