public T first(){
  if (filter == null) {
    List<SearchResultResourceRep> resultRefs=resources.performSearch(parameters);
    if (resultRefs.isEmpty()) {
      return null;
    }
    return resources.get(resultRefs.get(0));
  }
 else {
    List<T> items=run();
    if (items.isEmpty()) {
      return null;
    }
    return items.get(0);
  }
}

public T first ( ) { if ( filter == null ) { List < SearchResultResourceRep > resultRefs = resources . performSearch ( parameters ) ; if ( resultRefs . isEmpty ( ) ) { return null ; } return resources . get ( resultRefs . get ( 0 ) ) ; } else { List < T > items = run ( ) ; if ( items . isEmpty ( ) ) { return null ; } return items . get ( 0 ) ; } }
runs a search based on the criteria built with this searchbuilder . only the first search result is returned .
