public static TransferableGraph1 create(ReadGraph graph, TransferableGraphSource source) throws DatabaseException {
- final TIntArrayList statements = new TIntArrayList();
- final ArrayList<Value> values = new ArrayList<>();
- final ArrayList<Identity> identities = new ArrayList<>();
-
try {
+ ArrayList<Identity> identities = new ArrayList<>(source.getIdentityCount());
+ source.forIdentities(graph, i -> identities.add(i));
+ TIntArrayList statements = new TIntArrayList(source.getStatementCount());
source.forStatements(graph, r -> statements.addAll(r));
+ ArrayList<Value> values = new ArrayList<>(source.getValueCount());
source.forValues(graph, v -> values.add(v));
- source.forIdentities(graph, i -> identities.add(i));
return new TransferableGraph1(source.getResourceCount(),
identities.toArray(new Identity[identities.size()]),