From 5e7d43da20f2d7298da1b9f38d8129b0cfdde824 Mon Sep 17 00:00:00 2001 From: andreoss Date: Tue, 29 Sep 2020 19:34:29 -0400 Subject: [PATCH] (#1169) Wild-cards for parameters --- src/main/java/org/cactoos/list/Joined.java | 6 +++--- src/main/java/org/cactoos/list/ListOf.java | 9 +++++---- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/src/main/java/org/cactoos/list/Joined.java b/src/main/java/org/cactoos/list/Joined.java index a5d9edd8a9..44338bcfda 100644 --- a/src/main/java/org/cactoos/list/Joined.java +++ b/src/main/java/org/cactoos/list/Joined.java @@ -42,7 +42,7 @@ public final class Joined extends ListEnvelope { * @param src Source lists */ @SafeVarargs - public Joined(final List... src) { + public Joined(final List... src) { this(new IterableOf<>(src)); } @@ -53,7 +53,7 @@ public Joined(final List... src) { * @since 0.32 */ @SuppressWarnings("unchecked") - public Joined(final X item, final List items) { + public Joined(final X item, final List items) { this(new ListOf<>(item), items); } @@ -61,7 +61,7 @@ public Joined(final X item, final List items) { * Ctor. * @param src Source lists */ - public Joined(final Iterable> src) { + public Joined(final Iterable> src) { super( new ListOf<>(src).stream() .flatMap(List::stream) diff --git a/src/main/java/org/cactoos/list/ListOf.java b/src/main/java/org/cactoos/list/ListOf.java index 21c9e487e6..815da6b4ed 100644 --- a/src/main/java/org/cactoos/list/ListOf.java +++ b/src/main/java/org/cactoos/list/ListOf.java @@ -41,9 +41,10 @@ public final class ListOf extends ListEnvelope { * Ctor. * * @param array An array of some elements + * @param Sub-type of T */ @SafeVarargs - public ListOf(final T... array) { + public ListOf(final Z... array) { this(new IterableOf<>(array)); } @@ -52,15 +53,15 @@ public ListOf(final T... array) { * @param src An {@link Iterator} * @since 0.21 */ - public ListOf(final Iterator src) { - this(() -> src); + public ListOf(final Iterator src) { + this(new IterableOf(src)); } /** * Ctor. * @param src An {@link Iterable} */ - public ListOf(final Iterable src) { + public ListOf(final Iterable src) { super(new LinkedList<>()); src.forEach(super::add); }