diff --git a/src/main/java/org/cactoos/text/Sub.java b/src/main/java/org/cactoos/text/Sub.java index 7c96a3eca1..8a9975deb8 100644 --- a/src/main/java/org/cactoos/text/Sub.java +++ b/src/main/java/org/cactoos/text/Sub.java @@ -93,19 +93,19 @@ public Sub(final Text text, final Scalar strt, public Sub(final Text text, final Unchecked start, final Unchecked end) { super( - new TextOf( - () -> { + new Mapped( + origin -> { int begin = start.value(); if (begin < 0) { begin = 0; } int finish = end.value(); - final String origin = text.asString(); if (origin.length() < finish) { finish = origin.length(); } return origin.substring(begin, finish); - } + }, + text ) ); }