From 6615a281db0a10750fe56b974a2a4b4f9ed4cb06 Mon Sep 17 00:00:00 2001 From: andreoss Date: Fri, 16 Oct 2020 17:33:38 +0300 Subject: [PATCH] (#1462) Use `text.Mapped` --- src/main/java/org/cactoos/text/TrimmedRight.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/main/java/org/cactoos/text/TrimmedRight.java b/src/main/java/org/cactoos/text/TrimmedRight.java index 8f7004baef..49cf7ab636 100644 --- a/src/main/java/org/cactoos/text/TrimmedRight.java +++ b/src/main/java/org/cactoos/text/TrimmedRight.java @@ -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 ) ); }