/* (non-Javadoc)
@see com.googlecode.batchfb.Batcher#queryFirst(java.lang.String)
327959
@Override
	public Later<JsonNode> queryFirst(String fql) {
		Later<ArrayNode> q = this.query(fql);
		return new FirstNodeLater(q);
	}
39253
public T first() {
        Iterator<T> iterator = iterator();
        return (iterator.hasNext() ? iterator.next() : null);
    }
1340429
public TResult queryForChunk(String orderBy, int limit, long offset) {
		return query(null, null, null, null, orderBy, buildLimit(limit, offset));
	}
996665
private Object getFirstResult(KunderaQuery query, String field, SearchHits hits, Class clazz, Metamodel metaModel,
            EntityMetadata entityMetadata)
    {
        Object entity;

        if (query.getEntityAlias().equals(field))
        {
            entity = getEntityObjects(clazz, entityMetadata, metaModel.entity(clazz), hits).get(0);
        }
        else
        {
            String jpaField = ((AbstractAttribute) metaModel.entity(clazz).getAttribute(field)).getJPAColumnName();
            entity = query.getSelectStatement().hasGroupByClause() ? hits.getAt(0).sourceAsMap().get(jpaField) : hits
                    .getAt(0).getFields().get(jpaField).getValue();
        }
        return entity;
    }
350103
public T firstResult() {
        if (response != null && response.size() > 0) {
            return response.get(0).first();
        }
        return null;
    }
456602
public TResult queryForEq(String fieldName, Object value) {
		return queryForEq(fieldName, value, null, null, null);
	}
1308445
public HashMap<String, Object> getFirstResult(String query)
        throws Exception {
        HashMap<String, Object> result = null;

        Statement queryStatement = null;
        ResultSet results = null;
        try (Connection sqlConnection = getConnection()) {
            queryStatement = sqlConnection.createStatement();
            results = queryStatement.executeQuery(query);
            if (results.next()) {
                result = new HashMap<>();
                String[] columns = getColumnNames(results.getMetaData());

                for (String column : columns) {
                    result.put(column, results.getObject(column));
                }
            }
        } catch (Exception e) {

        } finally {
            try {
                if (results != null) {
                    results.close();
                }
            } catch (Exception e) {
            }
            try {
                if (queryStatement != null) {
                    queryStatement.close();
                }
            } catch (Exception e) {
            }
        }

        return result;
    }
1098640
@SuppressWarnings("unchecked")
    public final T first(T defaultValue) {
        if (this instanceof Callable) {
            return checkedCall((Callable<T>) this);
        }
        Iterator<T> it = iterator();
        if (it.hasNext()) {
            return it.next();
        }
        return defaultValue;
    }
560490
@Nullable
	public static String firstString(PreparedStatement stmt) throws SQLException {
		ResultSet rs = stmt.executeQuery();
		String s = rs.next() ? rs.getString(1) : null;
		stmt.close();
		return s;
	}
672259
public static <T> T getFirst(Iterator<T> iterator) {
		if (null != iterator && iterator.hasNext()) {
			return iterator.next();
		}
		return null;
	}
1203278
public E pollFirst() {
        final Node<E> f = first;
        return (f == null) ? null : unlinkFirst(f);
    }
367322
def fetchFirstExample(self, exampleDict, rawResults = False) :
        """"""
        return self.simpleQuery('first-example', rawResults = rawResults, example = exampleDict)
102516
public Iterable<DUser> queryByFirstName(java.lang.String firstName) {
    return queryByField(null, DUserMapper.Field.FIRSTNAME.getFieldName(), firstName);
  }
201288
public String getFirst(String key)
    {
        if(key == null)
            throw new IllegalArgumentException("Null keys not allowed.");

        List<String> vals = map.get(key);
        if(vals == null || vals.size() == 0)
            return null;

        return vals.get(0);
    }
4993
public <V> V executeAndFetchFirst(Class<V> returnType) {
        Object o = executeScalar();
        if (null == o) {
            return null;
        }
        return convert(o, returnType);
    }
872980
@Override
	public <T> T first(final Class<T> type) {
		return findFirst(type).orElseThrow(() -> new DataNotFoundException("query result is empty."));
	}
699913
public T queryForFirst(DatabaseConnection databaseConnection, PreparedStmt<T> preparedStmt, ObjectCache objectCache)
			throws SQLException {
		CompiledStatement compiledStatement = preparedStmt.compile(databaseConnection, StatementType.SELECT);
		DatabaseResults results = null;
		try {
			compiledStatement.setMaxRows(1);
			results = compiledStatement.runQuery(objectCache);
			if (results.first()) {
				logger.debug("query-for-first of '{}' returned at least 1 result", preparedStmt.getStatement());
				return preparedStmt.mapRow(results);
			} else {
				logger.debug("query-for-first of '{}' returned 0 results", preparedStmt.getStatement());
				return null;
			}
		} finally {
			IOUtils.closeThrowSqlException(results, "results");
			IOUtils.closeThrowSqlException(compiledStatement, "compiled statement");
		}
	}