public Node selectFirst(String query){
  List<Node> selectedNodes=select(query);
  if (selectedNodes.isEmpty()) {
    return null;
  }
  return selectedNodes.get(0);
}

public Node selectFirst ( String query ) { List < Node > selectedNodes = select ( query ) ; if ( selectedNodes . isEmpty ( ) ) { return null ; } return selectedNodes . get ( 0 ) ; }
selects nodes using css3 selector query and returns the very first one .
