Use pattern matching for instanceof (#1019)

This commit is contained in:
altrisi authored and GitHub committed 2021-07-21 22:24:24 -03:00
1 parent 97e7d660e4
commit 7ebc990ef6
8 files changed
+24 -48

No files matched your search

@@ -51,9 +51,8 @@ public class Sys {
expression.addUnaryFunction("number", v ->
{
if (v instanceof NumericValue)
if (v instanceof NumericValue num)
{
NumericValue num = (NumericValue)v;
if (num.isInteger()) return new NumericValue(num.getLong());
return new NumericValue(num.getDouble());
}