Skip to content

Commit

Permalink
Merge branch '__rultor'
Browse files Browse the repository at this point in the history
  • Loading branch information
rultor committed Jun 27, 2017
2 parents aba0fd2 + fa8d4a0 commit a21f88e
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 33 deletions.
55 changes: 23 additions & 32 deletions src/main/java/org/cactoos/text/JoinedText.java
Original file line number Diff line number Diff line change
Expand Up @@ -52,54 +52,45 @@ public final class JoinedText implements Text {

/**
* Ctor.
* @param delimiter Delimit among texts
* @param texts Texts to be joined
* @param delimit Delimit among strings
* @param strs Strings to be joined
*/
public JoinedText(final String delimiter, final String... texts) {
this(
new StringAsText(delimiter),
new MappedIterable<>(
new ArrayAsIterable<>(texts),
text -> new StringAsText(text)
)
);
public JoinedText(final String delimit, final String... strs) {
this(delimit, new ArrayAsIterable<>(strs));
}

/**
* Ctor.
* @param delimiter Delimit among texts
* @param texts Texts to be joined
* @param delimit Delimit among strings
* @param strs Strings to be joined
*/
public JoinedText(final String delimiter, final Text... texts) {
this(delimiter, new ArrayAsIterable<>(texts));
}

/**
* Ctor.
* @param delimiter Delimit among texts
* @param texts Texts to be joined
*/
public JoinedText(final String delimiter, final Iterable<Text> texts) {
this(new StringAsText(delimiter), texts);
public JoinedText(final String delimit, final Iterable<String> strs) {
this(
new StringAsText(delimit),
new MappedIterable<>(
strs,
text -> new StringAsText(text)
)
);
}

/**
* Ctor.
* @param delimiter Delimit among texts
* @param texts Texts to be joined
* @param delimit Delimit among texts
* @param txts Texts to be joined
*/
public JoinedText(final Text delimiter, final Text... texts) {
this(delimiter, new ArrayAsIterable<>(texts));
public JoinedText(final Text delimit, final Text... txts) {
this(delimit, new ArrayAsIterable<>(txts));
}

/**
* Ctor.
* @param delimiter Delimit among texts
* @param texts Texts to be joined
* @param delimit Delimit among texts
* @param txts Texts to be joined
*/
public JoinedText(final Text delimiter, final Iterable<Text> texts) {
this.delimiter = delimiter;
this.texts = texts;
public JoinedText(final Text delimit, final Iterable<Text> txts) {
this.delimiter = delimit;
this.texts = txts;
}

@Override
Expand Down
2 changes: 1 addition & 1 deletion src/test/java/org/cactoos/text/JoinedTextTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ public void joinsTexts() throws IOException {
MatcherAssert.assertThat(
"Can't join texts",
new JoinedText(
" ",
new StringAsText(" "),
new StringAsText("foo"),
new StringAsText("bar")
),
Expand Down

0 comments on commit a21f88e

Please sign in to comment.