Skip to content

Commit

Permalink
(#1566) Generify JoinedListIterator
Browse files Browse the repository at this point in the history
  • Loading branch information
DmitryBarskov committed May 6, 2022
1 parent 0f13734 commit 96afa40
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/main/java/org/cactoos/list/JoinedListIterator.java
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ public final class JoinedListIterator<T> implements ListIterator<T> {
* @param items Items to concatenate
*/
@SafeVarargs
public JoinedListIterator(final ListIterator<T>... items) {
public JoinedListIterator(final ListIterator<? extends T>... items) {
this(new ListOf<>(items));
}

Expand Down
5 changes: 3 additions & 2 deletions src/test/java/org/cactoos/list/JoinedListIteratorTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ void joinsListIterators() {
new Assertion<>(
"Must concatenate iterable of listIterators together",
new IterableOf<>(
new JoinedListIterator<>(
new JoinedListIterator<String>(
new ListOf<>("x").listIterator(),
new ListOf<>("y").listIterator()
)
Expand All @@ -60,7 +60,8 @@ void joinsListIterators() {
void navigatesInNonEmptyIterator() {
final ListIterator<Integer> joined = new JoinedListIterator<>(
new ListOf<>(1).listIterator(),
new ListOf<>(2).listIterator()
new ListOf<>(2).listIterator(),
new ListOf<>(3).listIterator()
);
new Assertion<>(
"Must call next method directly on non-empty listIterator for the first time",
Expand Down

0 comments on commit 96afa40

Please sign in to comment.