Github user twilmes commented on a diff in the pull request: https://github.com/apache/tinkerpop/pull/891#discussion_r204065865 --- Diff: gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/graphml/GraphMLWriter.java --- @@ -218,20 +220,33 @@ private void writeTypes(final Map<String, String> identifiedVertexKeyTypes, final Map<String, String> identifiedEdgeKeyTypes, final XMLStreamWriter writer) throws XMLStreamException { // <key id="weight" for="edge" attr.name="weight" attr.type="float"/> - final Collection<String> vertexKeySet = getVertexKeysAndNormalizeIfRequired(identifiedVertexKeyTypes); + Collection<String> vertexKeySet = getVertexKeysAndNormalizeIfRequired(identifiedVertexKeyTypes); + Collection<String> edgeKeySet = getEdgeKeysAndNormalizeIfRequired(identifiedEdgeKeyTypes); + // in case vertex and edge may have the same attribute name, the key id in graphml have to be different + intersection = CollectionUtils.intersection(vertexKeySet, edgeKeySet); + // speeding-up later checks + if(intersection.isEmpty()){ --- End diff -- I can see what you're doing for the `null` check but I'm wondering if it's worth it versus just initializing the intersection to an empty set at the start to make the code a bit simpler. Did you do some performance comparison and identify that the null check approach was a lot faster?
---