diff --git a/src/main/java/com/redislabs/redisgraph/impl/resultset/ResultSetImpl.java b/src/main/java/com/redislabs/redisgraph/impl/resultset/ResultSetImpl.java index 952b015..df77cdd 100644 --- a/src/main/java/com/redislabs/redisgraph/impl/resultset/ResultSetImpl.java +++ b/src/main/java/com/redislabs/redisgraph/impl/resultset/ResultSetImpl.java @@ -63,42 +63,43 @@ public ResultSetImpl(List rawResponse, RedisGraph redisGraph, GraphCache */ @SuppressWarnings("unchecked") private List parseResult(List> rawResultSet) { - List results = new ArrayList<>(); if (rawResultSet == null || rawResultSet.isEmpty()) { - return results; - } else { - // go over each raw result - for (List row : rawResultSet) { - - List parsedRow = new ArrayList<>(row.size()); - // go over each object in the result - for (int i = 0; i < row.size(); i++) { - // get raw representation of the object - List obj = (List) row.get(i); - // get object type - Header.ResultSetColumnTypes objType = header.getSchemaTypes().get(i); - // deserialize according to type and - switch (objType) { - case COLUMN_NODE: - parsedRow.add(deserializeNode(obj)); - break; - case COLUMN_RELATION: - parsedRow.add(deserializeEdge(obj)); - break; - case COLUMN_SCALAR: - parsedRow.add(deserializeScalar(obj)); - break; - default: - parsedRow.add(null); - break; - } + return new ArrayList<>(0); + } + List results = new ArrayList<>(rawResultSet.size()); + // go over each raw result + for (List row : rawResultSet) { + + List parsedRow = new ArrayList<>(row.size()); + // go over each object in the result + for (int i = 0; i < row.size(); i++) { + // get raw representation of the object + List obj = (List) row.get(i); + // get object type + Header.ResultSetColumnTypes objType = header.getSchemaTypes().get(i); + // deserialize according to type and + switch (objType) { + case COLUMN_NODE: + parsedRow.add(deserializeNode(obj)); + break; + case COLUMN_RELATION: + parsedRow.add(deserializeEdge(obj)); + break; + case COLUMN_SCALAR: + parsedRow.add(deserializeScalar(obj)); + break; + default: + parsedRow.add(null); + break; } - // create new record from deserialized objects - Record record = new RecordImpl(header.getSchemaNames(), parsedRow); - results.add(record); } + + // create new record from deserialized objects + Record record = new RecordImpl(header.getSchemaNames(), parsedRow); + results.add(record); } + return results; }