From 43adab5654a2835211a21d48c807efcb7529e097 Mon Sep 17 00:00:00 2001 From: rocket Date: Sun, 12 Sep 2021 08:29:50 +0300 Subject: [PATCH] (#1569) Added wildcards in `AndInThreads` ctors. --- .../java/org/cactoos/scalar/AndInThreads.java | 42 ++++++++++++------- 1 file changed, 27 insertions(+), 15 deletions(-) diff --git a/src/main/java/org/cactoos/scalar/AndInThreads.java b/src/main/java/org/cactoos/scalar/AndInThreads.java index 90b226844c..a6c4b77447 100644 --- a/src/main/java/org/cactoos/scalar/AndInThreads.java +++ b/src/main/java/org/cactoos/scalar/AndInThreads.java @@ -64,7 +64,7 @@ public final class AndInThreads implements Scalar { /** * The iterator. */ - private final Iterable> iterable; + private final Iterable> iterable; /** * Shut down the service when it's done. @@ -78,7 +78,7 @@ public final class AndInThreads implements Scalar { * @param Type of items in the iterable */ @SafeVarargs - public AndInThreads(final Func func, final X... src) { + public AndInThreads(final Func func, final X... src) { this(func, new IterableOf<>(src)); } @@ -88,8 +88,8 @@ public AndInThreads(final Func func, final X... src) { * @param src The iterable * @param Type of items in the iterable */ - public AndInThreads(final Func func, - final Iterable src) { + public AndInThreads(final Func func, + final Iterable src) { this( new Mapped<>( item -> new ScalarOf<>(() -> func.apply(item)), @@ -111,7 +111,7 @@ public AndInThreads(final Scalar... src) { * Ctor. * @param src The iterable */ - public AndInThreads(final Iterable> src) { + public AndInThreads(final Iterable> src) { this(Executors.newCachedThreadPool(), src, true); } @@ -123,8 +123,11 @@ public AndInThreads(final Iterable> src) { * @param Type of items in the iterable */ @SafeVarargs - public AndInThreads(final ExecutorService svc, - final Proc proc, final X... src) { + public AndInThreads( + final ExecutorService svc, + final Proc proc, + final X... src + ) { this(svc, new FuncOf<>(proc, true), src); } @@ -136,8 +139,11 @@ public AndInThreads(final ExecutorService svc, * @param Type of items in the iterable */ @SafeVarargs - public AndInThreads(final ExecutorService svc, - final Func func, final X... src) { + public AndInThreads( + final ExecutorService svc, + final Func func, + final X... src + ) { this(svc, func, new IterableOf<>(src)); } @@ -148,8 +154,11 @@ public AndInThreads(final ExecutorService svc, * @param src The iterable * @param Type of items in the iterable */ - public AndInThreads(final ExecutorService svc, - final Proc proc, final Iterable src) { + public AndInThreads( + final ExecutorService svc, + final Proc proc, + final Iterable src + ) { this(svc, new FuncOf<>(proc, true), src); } @@ -160,8 +169,11 @@ public AndInThreads(final ExecutorService svc, * @param src The iterable * @param Type of items in the iterable */ - public AndInThreads(final ExecutorService svc, - final Func func, final Iterable src) { + public AndInThreads( + final ExecutorService svc, + final Func func, + final Iterable src + ) { this( svc, new Mapped<>( @@ -188,7 +200,7 @@ public AndInThreads(final ExecutorService svc, * @param src The iterable */ public AndInThreads(final ExecutorService svc, - final Iterable> src) { + final Iterable> src) { this(svc, src, false); } @@ -199,7 +211,7 @@ public AndInThreads(final ExecutorService svc, * @param sht Shut it down */ private AndInThreads(final ExecutorService svc, - final Iterable> src, final boolean sht) { + final Iterable> src, final boolean sht) { this.service = svc; this.iterable = src; this.shut = sht;