Source:
<code>private void walkNetwork() { if (cableBlockEntities.isEmpty()) { return; } TechReborn.LOGGER.debug("Walking the Electric Network to detect for changes in neighbors..."); HashSet<CableBlockEntity> seenNodes = new HashSet<>(); HashSet<CableBlockEntity> visitedNodes = new HashSet<>(); CableBlockEntity firstNode = cableBlockEntities.iterator().next(); TechReborn.LOGGER.debug("First node in the walk: {}", firstNode); seenNodes.addAll(visitCableNode(firstNode, visitedNodes)); HashSet<CableBlockEntity> remainingNodesToVisit = new HashSet<>(seenNodes); while (!remainingNodesToVisit.isEmpty()) { for (CableBlockEntity nodeToVisit : remainingNodesToVisit) { seenNodes.addAll(visitCableNode(nodeToVisit, visitedNodes)); } remainingNodesToVisit.clear(); remainingNodesToVisit.addAll(seenNodes); remainingNodesToVisit.removeAll(visitedNodes); } for (CableBlockEntity nodeConnected : seenNodes) { if (nodeConnected.getElectricNetwork() != this) { TechReborn.LOGGER.debug( "Block network change: -> {}", nodeConnected.getPos().asLong(), nodeConnected.getElectricNetwork(), this); nodeConnected.setElectricNetwork(this); } } TechReborn.LOGGER.debug( "Starting purge of disconnected entities. Have {}, seen {}", cableBlockEntities.size(), seenNodes.size()); cableBlockEntities .stream() .filter(node -> !seenNodes.contains(node)) <START> .collect(Collectors.toList()) <END> .forEach(node -> { if (node != null) { TechReborn.LOGGER.debug( "Block being ejected from the network {}", node, this); node.setElectricNetwork(null); } }); TechReborn.LOGGER.debug("Finished walking network for cable connection changes."); }</code><technical_language>this collect call</technical_language>

Target:
private void walkNetwork() { if (cableBlockEntities.isEmpty()) { return; } TechReborn.LOGGER.debug("Walking the Electric Network to detect for changes in neighbors..."); HashSet<CableBlockEntity> seenNodes = new HashSet<>(); HashSet<CableBlockEntity> visitedNodes = new HashSet<>(); CableBlockEntity firstNode = cableBlockEntities.iterator().next(); TechReborn.LOGGER.debug("First node in the walk: {}", firstNode); seenNodes.addAll(visitCableNode(firstNode, visitedNodes)); HashSet<CableBlockEntity> remainingNodesToVisit = new HashSet<>(seenNodes); while (!remainingNodesToVisit.isEmpty()) { for (CableBlockEntity nodeToVisit : remainingNodesToVisit) { seenNodes.addAll(visitCableNode(nodeToVisit, visitedNodes)); } remainingNodesToVisit.clear(); remainingNodesToVisit.addAll(seenNodes); remainingNodesToVisit.removeAll(visitedNodes); } for (CableBlockEntity nodeConnected : seenNodes) { if (nodeConnected.getElectricNetwork() != this) { TechReborn.LOGGER.debug( "Block network change: -> {}", nodeConnected.getPos().asLong(), nodeConnected.getElectricNetwork(), this); nodeConnected.setElectricNetwork(this); } } TechReborn.LOGGER.debug( "Starting purge of disconnected entities. Have {}, seen {}", cableBlockEntities.size(), seenNodes.size()); cableBlockEntities .stream() .filter(node -> !seenNodes.contains(node) && node != null) .collect(Collectors.toList()) .forEach(node -> { TechReborn.LOGGER.debug( "Block being ejected from the network {}", node, this); node.setElectricNetwork(null); }); TechReborn.LOGGER.debug("Finished walking network for cable connection changes."); }