X-Git-Url: https://gerrit.simantics.org/r/gitweb?p=simantics%2Fplatform.git;a=blobdiff_plain;f=bundles%2Forg.simantics.graph.db%2Fsrc%2Forg%2Fsimantics%2Fgraph%2Fdb%2FTransferableGraphs.java;h=2b93df74dceeb0fed0b3f0c871a62fe043968d8a;hp=0841e1455569ed08e0f184c750c5125e9fe55aa3;hb=69d8f2b115a832560eca0d56903c8977178b71ab;hpb=9ea5cf59a4d87c3db3a486e86d7b54efffd5516d diff --git a/bundles/org.simantics.graph.db/src/org/simantics/graph/db/TransferableGraphs.java b/bundles/org.simantics.graph.db/src/org/simantics/graph/db/TransferableGraphs.java index 0841e1455..2b93df74d 100644 --- a/bundles/org.simantics.graph.db/src/org/simantics/graph/db/TransferableGraphs.java +++ b/bundles/org.simantics.graph.db/src/org/simantics/graph/db/TransferableGraphs.java @@ -597,15 +597,14 @@ public class TransferableGraphs { public static TransferableGraph1 create(ReadGraph graph, TransferableGraphSource source) throws DatabaseException { - final TIntArrayList statements = new TIntArrayList(); - final ArrayList values = new ArrayList<>(); - final ArrayList identities = new ArrayList<>(); - try { + ArrayList 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 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()]),