[
https://issues.apache.org/jira/browse/FLINK-5385?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15769647#comment-15769647
]
ASF GitHub Bot commented on FLINK-5385:
---------------------------------------
Github user wuchong commented on a diff in the pull request:
https://github.com/apache/flink/pull/3038#discussion_r93594267
--- Diff: flink-core/src/main/java/org/apache/flink/types/Row.java ---
@@ -113,4 +113,30 @@ public boolean equals(Object o) {
public int hashCode() {
return Arrays.hashCode(fields);
}
+
+ /**
+ * Creates a new Row and assigns the given values to the Row's fields.
+ * This is more convenient than using the constructor.
+ *
+ * <p>For example:
+ *
+ * <pre>
+ * Row.of("hello", true, 1L);}
+ * </pre>
+ * instead of
+ * <pre>
+ * Row row = new Row(3);
+ * row.setField(0, "hello");
+ * row.setField(1, true);
+ * row.setField(2, 1L);
+ * </pre>
+ *
+ */
+ public static Row of(Object... objects) {
--- End diff --
good point!
> Add a help function to create Row
> ---------------------------------
>
> Key: FLINK-5385
> URL: https://issues.apache.org/jira/browse/FLINK-5385
> Project: Flink
> Issue Type: Improvement
> Components: Core
> Reporter: Jark Wu
> Assignee: Jark Wu
>
> Currently, it is trivial to create a Row, for example:
> {code:java}
> Row row = new Row(3);
> row.setField(0, "hello");
> row.setField(1, true);
> row.setField(2, 1L);
> {code}
> It would be nice to have a help method {{of}} to create a Row, such as:
> {code:java}
> Row row = Row.of("hello", true, 1L);
> {code}
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)