Content deleted Content added
m cite repair; |
JnRouvignac (talk | contribs) Tags: Mobile edit Mobile web edit Advanced mobile edit |
||
Line 87:
It achieves this is in a different way, it allows to match the type of a structure, extract data out of it at the same time by declaring new variable. As such, it reduces the ceremony around type casting and value extraction. Pattern matching works best when used in conjunction with [[algebraic data types]] because all the cases can be enumerated and statically checked by the compiler.
See this example mock for
<syntaxhighlight lang="java">
int eval(Node n) {
|