Skip to content

Commit

Permalink
yegor256#1445: Add type to ctor (PECS)
Browse files Browse the repository at this point in the history
  • Loading branch information
fabriciofx committed Nov 4, 2020
1 parent 31971e9 commit d764d0b
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions src/main/java/org/cactoos/scalar/ScalarOf.java
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@
/**
* ScalarOf.
*
* @param <X> Element type
* @param <T> Element type
* @param <X> Input element type
* @param <T> Output element type
* @since 0.4
*/
public final class ScalarOf<X, T> extends ScalarEnvelope<T> {
Expand All @@ -56,19 +56,25 @@ public ScalarOf(final Runnable runnable, final T result) {
* @param proc Encapsulated proc
* @param ipt Input
* @param result Result to return
* @param <X> Input element type
* @since 0.41
*/
public ScalarOf(final Proc<? super X> proc, final X ipt, final T result) {
public <X> ScalarOf(
final Proc<? super X> proc,
final X ipt,
final T result
) {
this(new FuncOf<>(proc, result), ipt);
}

/**
* Ctor.
* @param fnc Encapsulated func
* @param ipt Input
* @param <X> Input element type
* @since 0.41
*/
public ScalarOf(final Func<? super X, T> fnc, final X ipt) {
public <X> ScalarOf(final Func<? super X, ? extends T> fnc, final X ipt) {
this(() -> fnc.apply(ipt));
}

Expand Down

0 comments on commit d764d0b

Please sign in to comment.