diff --git a/src/main/java/org/cactoos/text/FormattedText.java b/src/main/java/org/cactoos/text/FormattedText.java index c866581f9a..293aa62448 100644 --- a/src/main/java/org/cactoos/text/FormattedText.java +++ b/src/main/java/org/cactoos/text/FormattedText.java @@ -136,17 +136,15 @@ public FormattedText( final Collection args ) { super( - new TextOf( - () -> { - final StringBuilder out = new StringBuilder(0); + new Mapped( + pattern -> { + final StringBuilder out = new StringBuilder(pattern.length()); try (Formatter fmt = new Formatter(out, locale)) { - fmt.format( - ptn.asString(), - args.toArray() - ); + fmt.format(pattern, args.toArray()); } return out.toString(); - } + }, + ptn ) ); } diff --git a/src/main/java/org/cactoos/text/Rotated.java b/src/main/java/org/cactoos/text/Rotated.java index 31448c0b1c..0cc853c4d3 100644 --- a/src/main/java/org/cactoos/text/Rotated.java +++ b/src/main/java/org/cactoos/text/Rotated.java @@ -38,9 +38,8 @@ public final class Rotated extends TextEnvelope { */ public Rotated(final Text text, final int shift) { super( - new TextOf( - () -> { - String origin = text.asString(); + new Mapped( + origin -> { final int length = origin.length(); if (length != 0 && shift != 0 && shift % length != 0) { final StringBuilder builder = new StringBuilder(length); @@ -55,7 +54,8 @@ public Rotated(final Text text, final int shift) { ).toString(); } return origin; - } + }, + text ) ); }