Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(#1560) Delegate TextOf(Iterator) to TextOf(Iterable) #1599

Merged
merged 14 commits into from
May 8, 2021

Conversation

DmitryBarskov
Copy link
Contributor

@DmitryBarskov DmitryBarskov commented May 4, 2021

For #1560:

  • Constructor TextOf(Iterator) now delegates to TextOf(Iterable)
  • Constructor TextOf parameter is typed as Iterable<Character> instead of Iterable<?>
  • Add extra test for TextOf(Iterable)
  • Replace usages of TextOf(Iterable<?>) with Joined and Concatenated

Copy link
Collaborator

@victornoel victornoel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@DmitryBarskov just a little comment until a REV gets assigned to the PR :)

src/main/java/org/cactoos/text/TextOf.java Outdated Show resolved Hide resolved
@@ -124,7 +126,14 @@ public final void clear() {
public final String toString() {
return new StringBuilder()
.append('{')
.append(new TextOf(this.entrySet()).toString())
.append(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@DmitryBarskov Why use Concatenated and StringBuilder together?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do I do it right now?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@DmitryBarskov yes you should fix the issue the reviewer found, I think here he is hinting at the fact there is useless extra code and that it could be simplified… not 100% sure :)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@victornoel Yes, I got it, thank you. Just wanted to draw attention to the changes.

src/test/java/org/cactoos/text/TextOfTest.java Outdated Show resolved Hide resolved
src/test/java/org/cactoos/text/TextOfTest.java Outdated Show resolved Hide resolved
@DmitryBarskov DmitryBarskov changed the title (#1560) Delegate TextOf(Iterable) to TextOf(Iterator) (#1560) Delegate TextOf(Iterator) to TextOf(IteratorIterable) May 5, 2021
@DmitryBarskov DmitryBarskov changed the title (#1560) Delegate TextOf(Iterator) to TextOf(IteratorIterable) (#1560) Delegate TextOf(Iterator) to TextOf(Iterable) May 5, 2021
Copy link
Collaborator

@victornoel victornoel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@DmitryBarskov a few more comments

@@ -301,6 +301,18 @@ public void removeIsDelegated() {
).affirm();
}

@Test
public void testToString() {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@DmitryBarskov let's move this test in MapOfTest: even though it's implemented in MapEnvelope (which is a mistake I think, see #1606), this test is ultimately testing MapOf from a user point of view.

Copy link
Contributor Author

@DmitryBarskov DmitryBarskov May 7, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see there are tests for this method already, I'll just remove it.

public TextOf(final Iterable<?> iterable) {
* @todo #1560:30min/DEV We want {@link Concatenated} to have
* an extra constructor that accepts {@code Iterable<CharSequence>}
* to avoid creating of {@link Joined} with empty delimiter.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@DmitryBarskov actually it won't be possible to introduce such constructor because of type erasure, so I propose to simply write the following in the constructor below instead: new Concatenated(new Mapped(TextOf::new, iterable))

}
)
);
this(new IterableOf<>(iterator));
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@DmitryBarskov please move this constructor above (good practice is to always have the called constructor/methods below the calling ones)

@victornoel
Copy link
Collaborator

@DmitryBarskov @andreoss thx

@victornoel
Copy link
Collaborator

@rultor merge

@rultor
Copy link
Collaborator

rultor commented May 8, 2021

@rultor merge

@victornoel OK, I'll try to merge now. You can check the progress of the merge here

@rultor rultor merged commit 91d8840 into yegor256:master May 8, 2021
@rultor
Copy link
Collaborator

rultor commented May 8, 2021

@rultor merge

@victornoel Done! FYI, the full log is here (took me 13min)

@0crat 0crat added the qa label May 8, 2021
@0crat
Copy link
Collaborator

0crat commented May 8, 2021

@sereshqua/z please review this job completed by @andreoss/z, as in §30; the job will be fully closed and all payments will be made when the quality review is completed

@0crat 0crat removed the 0crat/scope label May 8, 2021
@sereshqua
Copy link

@DmitryBarskov please make sure you start all of the comments with the name of the user they are referred to, see

@sereshqua
Copy link

@0crat quality acceptable

@DmitryBarskov DmitryBarskov deleted the issue-1560 branch May 10, 2021 19:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants