public static AccessibilityNodeInfoCompat searchFromInOrderTraversal(Context context,AccessibilityNodeInfoCompat root,NodeFilter filter,int direction){
  AccessibilityNodeInfoCompat currentNode=NodeFocusFinder.focusSearch(root,direction);
  final HashSet<AccessibilityNodeInfoCompat> seenNodes=new HashSet<AccessibilityNodeInfoCompat>();
  while ((currentNode != null) && !seenNodes.contains(currentNode) && !filter.accept(context,currentNode)) {
    seenNodes.add(currentNode);
    currentNode=NodeFocusFinder.focusSearch(currentNode,direction);
  }
  AccessibilityNodeInfoUtils.recycleNodes(seenNodes);
  return currentNode;
}

public static AccessibilityNodeInfoCompat searchFromInOrderTraversal ( Context context , AccessibilityNodeInfoCompat root , NodeFilter filter , int direction ) { AccessibilityNodeInfoCompat currentNode = NodeFocusFinder . focusSearch ( root , direction ) ; final HashSet < AccessibilityNodeInfoCompat > seenNodes = new HashSet < AccessibilityNodeInfoCompat > ( ) ; while ( ( currentNode != null ) && ! seenNodes . contains ( currentNode ) && ! filter . accept ( context , currentNode ) ) { seenNodes . add ( currentNode ) ; currentNode = NodeFocusFinder . focusSearch ( currentNode , direction ) ; } AccessibilityNodeInfoUtils . recycleNodes ( seenNodes ) ; return currentNode ; }
performs in - order traversal from a given node in a particular direction until a node matching the specified filter is reached .
