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` on 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` 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 of 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` on 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` 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 of 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` on 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` 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 of 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