public static AccessibilityNodeInfoCompat searchFromBfs(Context context,AccessibilityNodeInfoCompat node,NodeFilter filter){
  if (node == null) {
    return null;
  }
  final LinkedList<AccessibilityNodeInfoCompat> queue=new LinkedList<AccessibilityNodeInfoCompat>();
  queue.add(AccessibilityNodeInfoCompat.obtain(node));
  while (!queue.isEmpty()) {
    final AccessibilityNodeInfoCompat item=queue.removeFirst();
    if (filter.accept(context,item)) {
      return AccessibilityNodeInfoCompat.obtain(item);
    }
    final int childCount=item.getChildCount();
    for (int i=0; i < childCount; i++) {
      final AccessibilityNodeInfoCompat child=item.getChild(i);
      if (child != null) {
        queue.addLast(child);
      }
    }
  }
  return null;
}

public static AccessibilityNodeInfoCompat searchFromBfs ( Context context , AccessibilityNodeInfoCompat node , NodeFilter filter ) { if ( node == null ) { return null ; } final LinkedList < AccessibilityNodeInfoCompat > queue = new LinkedList < AccessibilityNodeInfoCompat > ( ) ; queue . add ( AccessibilityNodeInfoCompat . obtain ( node ) ) ; while ( ! queue . isEmpty ( ) ) { final AccessibilityNodeInfoCompat item = queue . removeFirst ( ) ; if ( filter . accept ( context , item ) ) { return AccessibilityNodeInfoCompat . obtain ( item ) ; } final int childCount = item . getChildCount ( ) ; for ( int i = 0 ; i < childCount ; i ++ ) { final AccessibilityNodeInfoCompat child = item . getChild ( i ) ; if ( child != null ) { queue . addLast ( child ) ; } } } return null ; }
returns the result of applying a filter using breadth - first traversal .
