Package Summary Overview Summary

### class:TreeScanner [CHANGED]
Type Parameters: `R` - the return type of this visitor's methods. Use `Void` for visitors that do not need to return results. `P` - the type of the additional parameter to this visitor's methods. Use `Void` for visitors that do not need an additional parameter. All Implemented Interfaces: `TreeVisitor<R,P>` Direct Known Subclasses: `TreePathScanner` public class TreeScanner<R,P>extends Object implements TreeVisitor<R,P> `TreeScanner` relies on preview features of the Java platform: `TreeScanner` refers to one or more reflective preview APIs: `DefaultCaseLabelTree`, `GuardedPatternTree`, `ParenthesizedPatternTree`. Programs can only use `TreeScanner` when preview features are enabled. Preview features may be removed in a future release, or upgraded to permanent features of the Java platform. A TreeVisitor that visits all the child tree nodes. To visit nodes of a particular type, just override the corresponding visitXYZ method. Inside your method, call super.visitXYZ to visit descendant nodes. The default implementation of the visitXYZ methods will determine a result as follows: If the node being visited has no children, the result will be `null`. If the node being visited has one child, the result will be the result of calling `scan` with that child. The child may be a simple node or itself a list of nodes. If the node being visited has more than one child, the result will be determined by calling `scan` with each child in turn, and then combining the result of each scan after the first with the cumulative result so far, as determined by the `reduce(R, R)` method. Each child may be either a simple node or a list of nodes. The default behavior of the `reduce` method is such that the result of the visitXYZ method will be the result of the last child scanned. Here is an example to count the number of identifier nodes in a tree:
       class CountIdentifiers extends TreeScanner<Integer,Void> {
          @Override
          public Integer visitIdentifier(IdentifierTree node, Void p) {
              return 1;
          }
          @Override
          public Integer reduce(Integer r1, Integer r2) {
              return (r1 == null ? 0 : r1) + (r2 == null ? 0 : r2);
          }
       }
Since: 1.6
Type Parameters: `R` - the return type of this visitor's methods. Use `Void` for visitors that do not need to return results. `P` - the type of the additional parameter to this visitor's methods. Use `Void` for visitors that do not need an additional parameter. All Implemented Interfaces: `TreeVisitor<R,P>` Direct Known Subclasses: `TreePathScanner` public class TreeScanner<R,P>extends Object implements TreeVisitor<R,P> A TreeVisitor that visits all the child tree nodes. To visit nodes of a particular type, just override the corresponding visitXYZ method. Inside your method, call super.visitXYZ to visit descendant nodes. The default implementation of the visitXYZ methods will determine a result as follows: If the node being visited has no children, the result will be `null`. If the node being visited has one child, the result will be the result of calling `scan` with that child. The child may be a simple node or itself a list of nodes. If the node being visited has more than one child, the result will be determined by calling `scan` with each child in turn, and then combining the result of each scan after the first with the cumulative result so far, as determined by the `reduce(R, R)` method. Each child may be either a simple node or a list of nodes. The default behavior of the `reduce` method is such that the result of the visitXYZ method will be the result of the last child scanned. Here is an example to count the number of identifier nodes in a tree:
       class CountIdentifiers extends TreeScanner<Integer,Void> {
          @Override
          public Integer visitIdentifier(IdentifierTree node, Void p) {
              return 1;
          }
          @Override
          public Integer reduce(Integer r1, Integer r2) {
              return (r1 == null ? 0 : r1) + (r2 == null ? 0 : r2);
          }
       }
Since: 1.6 | Type Parameters: `R` - the return type of this visitor's methods. Use `Void` for visitors that do not need to return results. `P` - the type of the additional parameter to this visitor's methods. Use `Void` for visitors that do not need an additional parameter. All Implemented Interfaces: `TreeVisitor<R,P>` Direct Known Subclasses: `TreePathScanner` public class TreeScanner<R,P>extends Object implements TreeVisitor<R,P> `TreeScanner` relies on preview features of the Java platform: `TreeScanner` refers to one or more reflective preview APIs: `DefaultCaseLabelTree`, `GuardedPatternTree`, `ParenthesizedPatternTree`. Programs can only use `TreeScanner` when preview features are enabled. Preview features may be removed in a future release, or upgraded to permanent features of the Java platform. A TreeVisitor that visits all the child tree nodes. To visit nodes of a particular type, just override the corresponding visitXYZ method. Inside your method, call super.visitXYZ to visit descendant nodes. The default implementation of the visitXYZ methods will determine a result as follows: If the node being visited has no children, the result will be `null`. If the node being visited has one child, the result will be the result of calling `scan` with that child. The child may be a simple node or itself a list of nodes. If the node being visited has more than one child, the result will be determined by calling `scan` with each child in turn, and then combining the result of each scan after the first with the cumulative result so far, as determined by the `reduce(R, R)` method. Each child may be either a simple node or a list of nodes. The default behavior of the `reduce` method is such that the result of the visitXYZ method will be the result of the last child scanned. Here is an example to count the number of identifier nodes in a tree:
       class CountIdentifiers extends TreeScanner<Integer,Void> {
          @Override
          public Integer visitIdentifier(IdentifierTree node, Void p) {
              return 1;
          }
          @Override
          public Integer reduce(Integer r1, Integer r2) {
              return (r1 == null ? 0 : r1) + (r2 == null ? 0 : r2);
          }
       }
Since: 1.6

### method:visitDefaultCaseLabel(com.sun.source.tree.DefaultCaseLabelTree,P) [ADDED]
### visitDefaultCaseLabel public R visitDefaultCaseLabel (DefaultCaseLabelTreePREVIEW node, P p) `visitDefaultCaseLabel` is a reflective preview API of the Java platform. Preview features may be removed in a future release, or upgraded to permanent features of the Java platform. Visits a DefaultCaseLabelTree node. This implementation returns `null`. Specified by: `visitDefaultCaseLabel` in interface `TreeVisitor<R, P>` Parameters: `node` - the node being visited `p` - a parameter value Returns: the result of scanning Since: 17

### method:visitParenthesizedPattern(com.sun.source.tree.ParenthesizedPatternTree,P) [ADDED]
### visitParenthesizedPattern public R visitParenthesizedPattern (ParenthesizedPatternTreePREVIEW node, P p) `visitParenthesizedPattern` is a reflective preview API of the Java platform. Preview features may be removed in a future release, or upgraded to permanent features of the Java platform. Visits a ParenthesizedPatternTree node. This implementation scans the children in left to right order. Specified by: `visitParenthesizedPattern` in interface `TreeVisitor<R, P>` Parameters: `node` - the node being visited `p` - a parameter value Returns: the result of scanning Since: 17

### method:visitGuardedPattern(com.sun.source.tree.GuardedPatternTree,P) [ADDED]
### visitGuardedPattern public R visitGuardedPattern (GuardedPatternTreePREVIEW node, P p) `visitGuardedPattern` is a reflective preview API of the Java platform. Preview features may be removed in a future release, or upgraded to permanent features of the Java platform. Visits a GuardPatternTree node. This implementation scans the children in left to right order. Specified by: `visitGuardedPattern` in interface `TreeVisitor<R, P>` Parameters: `node` - the node being visited `p` - a parameter value Returns: the result of scanning Since: 17