Source:
<code>public DAG<ConfigVertex, MISTEdge> generateWithCheckpointedStates(final AvroDag avroDag, final QueryCheckpoint checkpointedState) { final List<ConfigVertex> deserializedVertices = new ArrayList<>(avroDag.getAvroVertices().size()); final DAG<ConfigVertex, MISTEdge> configDag = new AdjacentListDAG<>(); final List<AvroVertex> avroVertices = avroDag.getAvroVertices(); if (checkpointedState == null) { for (final AvroVertex avroVertex : avroVertices) { final ExecutionVertex.Type type = getVertexType(avroVertex); final ConfigVertex configVertex = new ConfigVertex(Long.toString(configVertexId.getAndIncrement()), type, avroVertex.getConfiguration()); deserializedVertices.add(configVertex); configDag.addVertex(configVertex); } } else { final int numVertices = avroVertices.size(); <START> final List<StateWithTimestamp> queryState = checkpointedState.getQueryState(); <END> for (int i = 0; i < numVertices; i++) { final AvroVertex avroVertex = avroVertices.get(i); final StateWithTimestamp vertexStateWithTimestamp = queryState.get(i); final ExecutionVertex.Type type = getVertexType(avroVertex); final ConfigVertex configVertex = new ConfigVertex( Long.toString(configVertexId.getAndIncrement()), type, avroVertex.getConfiguration(), vertexStateWithTimestamp.getVertexState(), vertexStateWithTimestamp.getLatestCheckpointTimestamp()); deserializedVertices.add(configVertex); configDag.addVertex(configVertex); } } for (final Edge edge : avroDag.getEdges()) { final int srcIndex = edge.getFrom(); final int dstIndex = edge.getTo(); final ConfigVertex deserializedSrcVertex = deserializedVertices.get(srcIndex); final ConfigVertex deserializedDstVertex = deserializedVertices.get(dstIndex); configDag.addEdge(deserializedSrcVertex, deserializedDstVertex, new MISTEdge(edge.getDirection(), edge.getBranchIndex())); } return configDag; }</code><technical_language>Do guarantee state order vertex order same</technical_language>

Target:
public DAG<ConfigVertex, MISTEdge> generateWithCheckpointedStates(final AvroDag avroDag, final QueryCheckpoint checkpointedState) { final List<ConfigVertex> deserializedVertices = new ArrayList<>(avroDag.getAvroVertices().size()); final DAG<ConfigVertex, MISTEdge> configDag = new AdjacentListDAG<>(); final List<AvroVertex> avroVertices = avroDag.getAvroVertices(); if (checkpointedState == null) { for (final AvroVertex avroVertex : avroVertices) { final ExecutionVertex.Type type = getVertexType(avroVertex); final ConfigVertex configVertex = new ConfigVertex(avroVertex.getVertexId(), type, avroVertex.getConfiguration()); deserializedVertices.add(configVertex); configDag.addVertex(configVertex); } } else { final int numVertices = avroVertices.size(); final Map<String, StateWithTimestamp> queryState = checkpointedState.getQueryState(); for (final AvroVertex avroVertex : avroVertices) { final StateWithTimestamp vertexStateWithTimestamp = queryState.get(avroVertex.getVertexId()); final ExecutionVertex.Type type = getVertexType(avroVertex); final ConfigVertex configVertex = new ConfigVertex( Long.toString(configVertexId.getAndIncrement()), type, avroVertex.getConfiguration(), vertexStateWithTimestamp.getVertexState(), vertexStateWithTimestamp.getCheckpointTimestamp()); deserializedVertices.add(configVertex); configDag.addVertex(configVertex); } } for (final Edge edge : avroDag.getEdges()) { final int srcIndex = edge.getFrom(); final int dstIndex = edge.getTo(); final ConfigVertex deserializedSrcVertex = deserializedVertices.get(srcIndex); final ConfigVertex deserializedDstVertex = deserializedVertices.get(dstIndex); configDag.addEdge(deserializedSrcVertex, deserializedDstVertex, new MISTEdge(edge.getDirection(), edge.getBranchIndex())); } return configDag; }