Skip to content

Commit

Permalink
(#1569) Exploit generic variance for Or
Browse files Browse the repository at this point in the history
  • Loading branch information
victornoel committed May 2, 2021
1 parent 15d32b0 commit 0bb95da
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions src/main/java/org/cactoos/scalar/Or.java
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ public final class Or implements Scalar<Boolean> {
/**
* The iterator.
*/
private final Iterable<Scalar<Boolean>> origin;
private final Iterable<? extends Scalar<Boolean>> origin;

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

Expand All @@ -101,7 +101,7 @@ public <X> Or(final Proc<X> proc, final X... src) {
* @param <X> Type of items in the iterable
*/
@SafeVarargs
public <X> Or(final Func<X, Boolean> func, final X... src) {
public <X> Or(final Func<? super X, Boolean> func, final X... src) {
this(func, new IterableOf<>(src));
}

Expand All @@ -112,7 +112,7 @@ public <X> Or(final Func<X, Boolean> func, final X... src) {
* @param <X> Type of items in the iterable
* @since 0.24
*/
public <X> Or(final Proc<X> proc, final Iterable<X> src) {
public <X> Or(final Proc<? super X> proc, final Iterable<? extends X> src) {
this(new FuncOf<>(proc, false), src);
}

Expand All @@ -122,7 +122,7 @@ public <X> Or(final Proc<X> proc, final Iterable<X> src) {
* @param src The iterable
* @param <X> Type of items in the iterable
*/
public <X> Or(final Func<X, Boolean> func, final Iterable<X> src) {
public <X> Or(final Func<? super X, Boolean> func, final Iterable<? extends X> src) {
this(
new Mapped<>(
item -> new ScalarOf<>(() -> func.apply(item)),
Expand All @@ -138,7 +138,7 @@ public <X> Or(final Func<X, Boolean> func, final Iterable<X> src) {
* @param <X> Type of items in the iterable
*/
@SafeVarargs
public <X> Or(final X subject, final Func<X, Boolean>... conditions) {
public <X> Or(final X subject, final Func<? super X, Boolean>... conditions) {
this(
new Mapped<>(
item -> new ScalarOf<>(() -> item.apply(subject)),
Expand All @@ -160,7 +160,7 @@ public Or(final Scalar<Boolean>... scalar) {
* Ctor.
* @param iterable The iterable.
*/
public Or(final Iterable<Scalar<Boolean>> iterable) {
public Or(final Iterable<? extends Scalar<Boolean>> iterable) {
this.origin = iterable;
}

Expand Down

0 comments on commit 0bb95da

Please sign in to comment.