Source:
ControlFlowGraph(Set<MutableBlock> blocks, MutableBlock start, MutableBlock end) { Map<MutableBlock, ControlFlowNode> immutableBlockByMutable = new HashMap<>(); ImmutableSet.Builder<ControlFlowBlock> immutableBlockSetBuilder = ImmutableSet.builder(); int index = 0; for (MutableBlock mutableBlock : blocks) { ImmutableBlock immutableBlock = new ImmutableBlock(index, mutableBlock.elements()); immutableBlockByMutable.put(mutableBlock, immutableBlock); immutableBlockSetBuilder.add(immutableBlock); index++; } immutableBlockByMutable.put(end, this.end); ImmutableSetMultimap.Builder<ControlFlowNode, ControlFlowNode> successorBuilder = ImmutableSetMultimap.builder(); ImmutableSetMultimap.Builder<ControlFlowNode, ControlFlowNode> predecessorBuilder = ImmutableSetMultimap.builder(); ImmutableSetMultimap.Builder<ControlFlowNode, SyntaxToken> jumpBuilder = ImmutableSetMultimap.builder(); for (MutableBlock mutableBlock : blocks) { ControlFlowNode immutableBlock = immutableBlockByMutable.get(mutableBlock); for (MutableBlock mutableBlockSuccessor : mutableBlock.successors()) { ControlFlowNode immutableBlockSuccessor = immutableBlockByMutable.get(mutableBlockSuccessor); predecessorBuilder.put(immutableBlockSuccessor, immutableBlock); successorBuilder.put(immutableBlock, immutableBlockSuccessor); } jumpBuilder.putAll(immutableBlock, mutableBlock.disconnectingJumps()); } this.start = blocks.isEmpty() ? this.end : immutableBlockByMutable.get(start); this.blocks = immutableBlockSetBuilder.build(); this.predecessors = predecessorBuilder.build(); this.successors = successorBuilder.build(); this.disconnectingJumps = jumpBuilder.build(); }

Target:
ControlFlowGraph(Set<MutableBlock> blocks, MutableBlock start, MutableBlock end) { Map<MutableBlock, ControlFlowNode> immutableBlockByMutable = new HashMap<>(); ImmutableSet.Builder<ControlFlowBlock> immutableBlockSetBuilder = ImmutableSet.builder(); for (MutableBlock mutableBlock : blocks) { ImmutableBlock immutableBlock = new ImmutableBlock(mutableBlock.elements()); immutableBlockByMutable.put(mutableBlock, immutableBlock); immutableBlockSetBuilder.add(immutableBlock); } immutableBlockByMutable.put(end, this.end); ImmutableSetMultimap.Builder<ControlFlowNode, ControlFlowNode> successorBuilder = ImmutableSetMultimap.builder(); ImmutableSetMultimap.Builder<ControlFlowNode, ControlFlowNode> predecessorBuilder = ImmutableSetMultimap.builder(); ImmutableSetMultimap.Builder<ControlFlowNode, SyntaxToken> jumpBuilder = ImmutableSetMultimap.builder(); for (MutableBlock mutableBlock : blocks) { ControlFlowNode immutableBlock = immutableBlockByMutable.get(mutableBlock); for (MutableBlock mutableBlockSuccessor : mutableBlock.successors()) { ControlFlowNode immutableBlockSuccessor = immutableBlockByMutable.get(mutableBlockSuccessor); predecessorBuilder.put(immutableBlockSuccessor, immutableBlock); successorBuilder.put(immutableBlock, immutableBlockSuccessor); } jumpBuilder.putAll(immutableBlock, mutableBlock.disconnectingJumps()); } this.start = blocks.isEmpty() ? this.end : immutableBlockByMutable.get(start); this.blocks = immutableBlockSetBuilder.build(); this.predecessors = predecessorBuilder.build(); this.successors = successorBuilder.build(); this.disconnectingJumps = jumpBuilder.build(); }