Skip to content

Commit

Permalink
(yegor256#1462) Use text.Mapped
Browse files Browse the repository at this point in the history
  • Loading branch information
andreoss committed Oct 16, 2020
1 parent 9e931a2 commit 6615a28
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/main/java/org/cactoos/text/TrimmedRight.java
Original file line number Diff line number Diff line change
Expand Up @@ -40,15 +40,15 @@ public final class TrimmedRight extends TextEnvelope {
*/
public TrimmedRight(final Text text) {
super(
new TextOf(
() -> {
final String string = text.asString();
new Mapped(
string -> {
int cursor = string.length() - 1;
while (cursor >= 0 && Character.isWhitespace(string.charAt(cursor))) {
cursor = cursor - 1;
}
return string.substring(0, cursor + 1);
}
},
text
)
);
}
Expand Down

0 comments on commit 6615a28

Please sign in to comment.