Skip to content

Commit

Permalink
(yegor256#1569) Added wildcards in AndWithIndex ctors.
Browse files Browse the repository at this point in the history
  • Loading branch information
rocket-3 committed Sep 12, 2021
1 parent 43adab5 commit 259d9b3
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions src/main/java/org/cactoos/scalar/AndWithIndex.java
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ public final class AndWithIndex implements Scalar<Boolean> {
/**
* The iterator.
*/
private final Iterable<Func<Integer, Boolean>> iterable;
private final Iterable<? extends Func<Integer, Boolean>> iterable;

/**
* Ctor.
Expand All @@ -77,7 +77,7 @@ public final class AndWithIndex implements Scalar<Boolean> {
* @param <X> Type of items in the iterable
*/
@SafeVarargs
public <X> AndWithIndex(final Proc<X> proc, final X... src) {
public <X> AndWithIndex(final Proc<? super X> proc, final X... src) {
this(new BiFuncOf<>(proc, true), src);
}

Expand All @@ -88,7 +88,7 @@ public <X> AndWithIndex(final Proc<X> proc, final X... src) {
* @param <X> Type of items in the iterable
*/
@SafeVarargs
public <X> AndWithIndex(final BiFunc<X, Integer, Boolean> func,
public <X> AndWithIndex(final BiFunc<? super X, Integer, Boolean> func,
final X... src) {
this(func, new IterableOf<>(src));
}
Expand All @@ -100,8 +100,8 @@ public <X> AndWithIndex(final BiFunc<X, Integer, Boolean> func,
* @param <X> Type of items in the iterable
* @since 0.24
*/
public <X> AndWithIndex(final BiProc<X, Integer> proc,
final Iterable<X> src) {
public <X> AndWithIndex(final BiProc<? super X, Integer> proc,
final Iterable<? extends X> src) {
this(new BiFuncOf<>(proc, true), src);
}

Expand All @@ -112,8 +112,8 @@ public <X> AndWithIndex(final BiProc<X, Integer> proc,
* @param <X> Type of items in the iterable
* @since 0.24
*/
public <X> AndWithIndex(final BiFunc<X, Integer, Boolean> func,
final Iterable<X> src) {
public <X> AndWithIndex(final BiFunc<? super X, Integer, Boolean> func,
final Iterable<? extends X> src) {
this(
new Mapped<>(
item -> new FuncOf<>(input -> func.apply(item, input)),
Expand All @@ -135,7 +135,7 @@ public AndWithIndex(final Func<Integer, Boolean>... src) {
* Ctor.
* @param src The iterable
*/
public AndWithIndex(final Iterable<Func<Integer, Boolean>> src) {
public AndWithIndex(final Iterable<? extends Func<Integer, Boolean>> src) {
this.iterable = src;
}

Expand Down

0 comments on commit 259d9b3

Please sign in to comment.