Skip to content

Commit

Permalink
(yegor256#1566) Generify Joined
Browse files Browse the repository at this point in the history
  • Loading branch information
DmitryBarskov committed May 6, 2022
1 parent c411273 commit 0f13734
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion src/main/java/org/cactoos/list/Joined.java
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ public Joined(final X item, final List<? extends X> items) {
* Ctor.
* @param src Source lists
*/
public Joined(final Iterable<List<? extends X>> src) {
public Joined(final Iterable<? extends List<? extends X>> src) {
super(
new ListOf<>(src).stream()
.flatMap(List::stream)
Expand Down
12 changes: 6 additions & 6 deletions src/main/java/org/cactoos/list/JoinedListIterator.java
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ public final class JoinedListIterator<T> implements ListIterator<T> {
/**
* {@link List} of {@link ListIterator}.
*/
private final List<ListIterator<T>> listiters;
private final List<ListIterator<? extends T>> listiters;

/**
* Cursor of the {@link List} of {@link ListIterator}.
Expand All @@ -74,7 +74,7 @@ public JoinedListIterator(final ListIterator<T>... items) {
* @param items ListIterator
*/
@SuppressWarnings("unchecked")
public JoinedListIterator(final T item, final ListIterator<T> items) {
public JoinedListIterator(final T item, final ListIterator<? extends T> items) {
this(new ListOf<>(new ListOf<>(item).listIterator(), items));
}

Expand All @@ -84,15 +84,15 @@ public JoinedListIterator(final T item, final ListIterator<T> items) {
* @param item End item
*/
@SuppressWarnings("unchecked")
public JoinedListIterator(final ListIterator<T> items, final T item) {
public JoinedListIterator(final ListIterator<? extends T> items, final T item) {
this(new ListOf<>(items, new ListOf<>(item).listIterator()));
}

/**
* Ctor.
* @param items Items to concatenate
*/
public JoinedListIterator(final List<ListIterator<T>> items) {
public JoinedListIterator(final List<ListIterator<? extends T>> items) {
this.listiters = items;
this.cursorlit = new AtomicInteger(-1);
this.cursor = new AtomicInteger(-1);
Expand Down Expand Up @@ -183,8 +183,8 @@ private boolean listHasPreviousElt() {
* Get current {@link ListIterator}.
* @return Current element
*/
private ListIterator<T> currentListIterator() {
final ListIterator<T> current;
private ListIterator<? extends T> currentListIterator() {
final ListIterator<? extends T> current;
if (this.cursorlit.get() == -1) {
current = Collections.emptyListIterator();
} else {
Expand Down

0 comments on commit 0f13734

Please sign in to comment.