[ https://issues.apache.org/jira/browse/FLINK-4440?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15434938#comment-15434938 ]
Greg Hogan commented on FLINK-4440: ----------------------------------- The referenced code from {{Graph}} could also use the diamond operator (as noted by IntelliJ): {code} out.collect(new Vertex<>(edge.f0, NullValue.getInstance())); out.collect(new Vertex<>(edge.f1, NullValue.getInstance())); {code} There are four uses of {{NullValue.getInstance()}} in {{Graph}}. The tests (({{HITSData}}, {{TriangleCountData}}, and {{LabelPropagationData}}) could be made to loop over an array to create the vertex and edge sets (as in {{AsmTestBase}} so as to only reference {{NullValue.getInstance()}} once. There is a cost to having a separate {{create}} method for constructing these classes. The current form is more verbose but also very clear. I expect most users to read input from sources such as {{GraphCsvReader}} which hide the assignment of {{NullValue}}. [~vkalavri] worked to build the {{Graph}} API and it would be good to hear her opinion. > Make API for edge/vertex creation less verbose > ---------------------------------------------- > > Key: FLINK-4440 > URL: https://issues.apache.org/jira/browse/FLINK-4440 > Project: Flink > Issue Type: Improvement > Components: Gelly > Reporter: Ivan Mushketyk > Assignee: Ivan Mushketyk > Priority: Trivial > > It would be better if one could create vertex/edges like this: > {code:java} > Vertex<Integer, NullValue> v = Vertex.create(42); > Edge<Integer, Integer, NullValue> e = Edge.create(5, 6); > {code} > Instead of this: > {code:java} > Vertex<Integer, NullValue> v = new Vertex<Integer, NullValue>(42, > NullValue.getInstance()); > Edge<Integer, Integer, NullValue> e = new Edge<Integer, Integer, > NullValue>(5, 6, NullValue.getInstance()); > {code} -- This message was sent by Atlassian JIRA (v6.3.4#6332)