maximusKon :
Is there in Cactoos framework some Text decorator (or maybe some other way), which replace null string with empty string? Like Strings.nullToEmpty function in Google Guava.
I have found NoNulls decorator, but I need just replacement without throwing exception.
So it must look like this:
String someNullString = null;
new StrictEmptyText(
new TextOf(someNullString) // this row produces NPE for now
).asString(); // ""
Thanks a lot for helping.
George Aristy :
No, there's no Text
implementation that does this for you in a direct way.
Using pure cactoos:
new TextOf(
new UncheckedScalar<>(
new Ternary<>(
someNullString != null,
someNullString,
""
)
).value()
)