Closed marek-parfianowicz closed 8 months ago
Java 14 introduced pattern matching for instanceof keyword, which allows to create a variable for the type matched, without type casting. Example:
instanceof
int sum = 0; if (o instanceof Integer i) { sum += i; }
To be implemented: optional identifier after type declaration.
Java 14 introduced pattern matching for
instanceof
keyword, which allows to create a variable for the type matched, without type casting. Example:int sum = 0; if (o instanceof Integer i) { sum += i; }
To be implemented: optional identifier after type declaration.