Remove redundant null checks in string concat

This commit is contained in:
altrisi authored and GitHub committed 2022-10-02 18:11:15 +02:00
1 parent 3247b83272
commit be1cb6888a
1 file changed
+3 -9
+3 -9
View File
@@ -66,19 +66,13 @@ public abstract class Value implements Comparable<Value>, Cloneable
public abstract boolean getBoolean();
public Value add(Value o) {
String lstr = this.getString();
if (o instanceof FormattedTextValue)
{
return FormattedTextValue.combine(this, o);
}
if (lstr == null) // null
return new StringValue(o.getString());
String rstr = o.getString();
if (rstr == null)
{
return new StringValue(lstr);
}
return new StringValue(lstr+rstr);
String leftStr = this.getString();
String rightStr = o.getString();
return new StringValue(leftStr + rightStr);
}
public Value subtract(Value v)
{