public static boolean equals(FlatRecordTraversalObjectNode left, FlatRecordTraversalObjectNode right) {
        if (left == null && right == null) {
            return true;
        }
        if (left == null || right == null) {
            return false;
        }
        if (!left.getSchema().getName().equals(right.getSchema().getName())) {
            return false;
        }
        extractCommonObjectSchema(left, right);

        return compare(left, right);
    }
@Test
    public void shouldFindSetAndMapFieldsAreEqualEvenIfOrderIsDifferent() {
        TypeState1 typeState1 = new TypeState1();
        typeState1.longField = 1L;
        typeState1.setOfScalars = new HashSet<>(Arrays.asList("B", "A"));
        typeState1.setOfObjects = new HashSet<>(Arrays.asList(
                new SubValue("B", "BB"),
                new SubValue("C", "CC"),
                new SubValue("A", "AA"))
        );
        typeState1.simpleMapField =
               new HashMap<String, SubValue>() {{
                   put("B", new SubValue("B", "BB"));
                     put("C", new SubValue("C", "CC"));
                        put("A", new SubValue("A", "AA"));
               }};

        writer1.reset();
        mapper1.writeFlat(typeState1, writer1);
        FlatRecord rec1 = writer1.generateFlatRecord();

        TypeState2 typeState2 = new TypeState2();
        typeState2.longField = 1L;
        typeState2.setOfScalars = new HashSet<>(Arrays.asList("A", "B"));
        typeState2.setOfObjects = new HashSet<>(Arrays.asList(
                new SubValue("A", "AA"),
                new SubValue("B", "BB"),
                new SubValue("C", "CC"))
        );
        typeState2.simpleMapField = new HashMap<String, SubValue>() {{
            put("A", new SubValue("A", "AA"));
            put("B", new SubValue("B", "BB"));
            put("C", new SubValue("C", "CC"));
        }};

        writer2.reset();
        mapper2.writeFlat(typeState2, writer2);
        FlatRecord rec2 = writer2.generateFlatRecord();
        FlatRecordTraversalObjectNode leftNode = new FlatRecordTraversalObjectNode(rec1);
        FlatRecordTraversalObjectNode rightNode = new FlatRecordTraversalObjectNode(rec2);

        assertThat(FlatRecordTraversalObjectNodeEquality.equals(leftNode, rightNode)).isTrue();
        assertThat(FlatRecordTraversalObjectNodeEquality.equals(rightNode, leftNode)).isTrue();
    }