Find a element or the first element.
337269
def find_element(self, value, by=By.ID, update=False) -> Elements:
        ''''''
        if update or not self._nodes:
            self.uidump()
        for node in self._nodes:
            if node.attrib[by] == value:
                bounds = node.attrib['bounds']
                coord = list(map(int, re.findall(r'\d+', bounds)))
                click_point = (coord[0] + coord[2]) / \
                    2, (coord[1] + coord[3]) / 2
                return self._element_cls(self, node.attrib, by, value, coord, click_point)
        raise NoSuchElementException(f'No such element: {by}={value!r}.')
1018651
public int findFirst(String str, String search) {
        return (str == null || search == null) ? -1 :
            str.indexOf(search);
    }
727706
def find_location(rows, element_to_find):
    ''''''
    for ir, row in enumerate(rows):
        for ic, element in enumerate(row):
            if element == element_to_find:
                return ir, ic
237107
def first(*args)
      if args.any?
        if args.first.kind_of?(Integer) || (loaded? && !args.first.kind_of?(Hash))
          limit(*args).to_a
        else
          apply_finder_options(args.first).first
        end
      else
        find_first
      end
    end
1187538
def _lookup_element(lst, key):
    '''
    
    '''
    if not lst:
        return {}
    for ele in lst:
        if not ele or not isinstance(ele, dict):
            continue
        if ele.keys()[0] == key:
            return ele.values()[0]
    return {}
573690
function findFirst(pred,from,to){// At any point we are certain `to` satisfies `pred`, don't know
// whether `from` does.
var dir=from>to?-1:1;for(;;){if(from==to){return from;}var midF=(from+to)/2,mid=dir<0?Math.ceil(midF):Math.floor(midF);if(mid==from){return pred(mid)?from:to;}if(pred(mid)){to=mid;}else{from=mid+dir;}}}
847875
def otherwise(first, second)
      first = first.to_s
      first.empty? ? second : first
    end
421433
def check_element_by_selector(self, selector):
    """"""
    elems = find_elements_by_jquery(world.browser, selector)
    if not elems:
        raise AssertionError("Expected matching elements, none found.")
796745
def find_one(self, cls, id):
        """"""
        found = self.find_by_index(cls, 'id', id)
        return found[0] if found else None
1147146
public void hasFirstElement(@NullableDecl Object element) {
    if (actualAsNavigableSet().isEmpty()) {
      failWithActual("expected to have first element", element);
      return;
    }

    if (!Objects.equal(actualAsNavigableSet().first(), element)) {
      if (actualAsNavigableSet().contains(element)) {
        failWithoutActual(
            simpleFact(
                lenientFormat(
                    "Not true that %s has first element <%s>. "
                        + "It does contain this element, but the first element is <%s>",
                    actualAsString(), element, actualAsNavigableSet().first())));
        return;
      }
      failWithoutActual(
          simpleFact(
              lenientFormat(
                  "Not true that %s has first element <%s>. "
                      + "It does not contain this element, and the first element is <%s>",
                  actualAsString(), element, actualAsNavigableSet().first())));
    }
  }
751566
public int find(int element) {
        if (trees[element] != element)
            trees[element] = find(trees[element]);
        return trees[element];
    }
472946
def find_element(self, by, value, view_cls=None):
        # type: (By, Any, View) -> View
        
        if view_cls is None:
            view_cls = View

        return view_cls(lambda: self.root.find_element(by, value))
1057281
def get(self, term, default=None):
        """"""
        v =  self.find_first(term)

        if not v:
            return default
        else:
            return v
854065
def find_segment_first(self, *args, **kwargs):
        """"""

        for m in self.find_segments(*args, **kwargs):
            return m

        return None
905005
public static Elements findElementsByTag(Element element, String ... tags) {
		List<Element> results = new ArrayList<Element>();
		
		Set<String> tagSet = new HashSet<String>();
		for(String tag : tags) 
			tagSet.add(tag.toLowerCase());
		filterElementsByTag(results, element, tagSet);
		return new Elements(results);
	}
	
	private static void filterElementsByTag(List<Element> results, Element element, Set<String> tagSet) {
		if(tagSet.contains(element.tag().getName().toLowerCase())) 
			results.add(element);
		
		for(Element child : element.children())
			filterElementsByTag(results, child, tagSet);
	}

	/** Returns the first element found with the given tag (or tag sequence separated by '/') or null. */
	public static Element findFirstByTag(Element element, String tag) {
		return findFirstByTag(element, tag.split("/"), 0);
	}
	
	private static Element findFirstByTag(Element current, String [] tags, int index) {
		if(index < tags.length) {
			Elements elements = current.getElementsByTag(tags[index]);
			for(Element element : elements) {
				Element result = findFirstByTag(element, tags, index + 1);
				if(result != null)
					return result;
			}
			return null;
		}
		else
			return current;
	}
    
}
828522
function findFirstNonvanishing (M, TOL) {
  const te = M.elements;
  const n = M.dimension;
  let rowCol = {
    row: 0,
    column: 0,
    value: te[0]
  };
  if (Compare.isZero(te[0], TOL)) {
    for (let i = 0; i < n; ++i) {
      for (let j = 0; j < n; ++j) {
        const val = te[i * n + j];
        if (!Compare.isZero(val, TOL)) {
          rowCol.row = j;
          rowCol.column = i;
          rowCol.value = val;
          return rowCol;
        }
      }
    }
  }
  return rowCol;
}
1081863
function findNext(type, element) {
  let tries = 5
  let next = element

  do {
    if (next.is(type)) {
      return next
    }

    next = next.next()
  }
  while (--tries)

  return next
}