private Stream<String> findDifferences(ArrayNode actual, ArrayNode expected, String prefix) {
        List<String> differences = new ArrayList<>();
        List<Node> actualElements = actual.getElements();
        List<Node> expectedElements = expected.getElements();

        for (int i = expectedElements.size(); i < actualElements.size(); i++) {
            differences.add(String.format(
                    "[%s]: Extra element encountered in list at position %d: %s",
                    prefix,
                    i,
                    nodeToJson(actualElements.get(i), true)));
        }

        for (int i = actualElements.size(); i < expectedElements.size(); i++) {
            differences.add(String.format(
                    "[%s]: Expected element (position %d) not encountered in list: %s",
                    prefix,
                    i,
                    nodeToJson(expectedElements.get(i), true)));
        }

        return Stream.concat(
                differences.stream(),
                IntStream.range(0, Math.min(actualElements.size(), expectedElements.size()))
                        .boxed()
                        .flatMap(i -> findDifferences(
                                actualElements.get(i),
                                expectedElements.get(i),
                                String.format("%s[%d]", prefix, i))));
    }
Creates a line-by-line diff of two Node values.
smithy-model/src/main/java/software/amazon/smithy/model/node/NodeDiff.java