You could even use a method reference here: "map(Row::of)"

On 22/03/2019 12:33, Chesnay Schepler wrote:
I can see that this would be convenient but please find a better example; yours can be solved easily using "Row.of(value)".

On 22/03/2019 12:26, Flavio Pompermaier wrote:
Hi all,
many times I had the feeling that allowing Row.setField() to return the
modified object instead of void would really make the (Java) code cleaner
in a very unobtrusive way.
For example, I could write something like:

DataSet<Row> columnData = input.map(value -> new Row(1).setField(0, value))

instead of:

DataSet<Row> columnData = input//
         .map(value -> {
           Row r = new Row(1);
           r.setField(0, value);
           return r;
         })

What do you think?
May I open a JIRA issue about it?

Best,
Flavio




Reply via email to