Use pattern matching for instanceof (#1019)
This commit is contained in:
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());
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user