cactoos
cactoos copied to clipboard
Add a new constructor public TextOf(final Iterable<?> iterable, String delimiter)
Current TextOf has the following public constructor:
public TextOf(final Iterable<?> iterable) {
this(
() -> new Joined(
", ",
new Mapped<>(
Object::toString,
iterable
)
).asString()
);
}
I propose to add one more constructor that accepts a delimiter:
public TextOf(final Iterable<?> iterable) {
this(iterable, ", ");
}
public TextOf(final Iterable<?> iterable, String delimiter) {
this(
() -> new Joined(
delimiter,
new Mapped<>(
Object::toString,
iterable
)
).asString()
);
}
I do understand that this has to be submitted as a pull request, but... :)
@paulodamaso/z please, pay attention to this issue
@tess1o/z this project will fix the problem faster if you donate a few dollars to it; just click here and pay via Stripe, it's very fast, convenient and appreciated; thanks a lot!
@tess1o https://github.com/yegor256/cactoos/blob/master/src/main/java/org/cactoos/text/Joined.java already does that, right?