-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add JacksonCollectors
with toArrayNode()
implementation
#4709
Add JacksonCollectors
with toArrayNode()
implementation
#4709
Conversation
Looks good overall, CLA seems to be sent. One last thing: I do think name |
Done as instructed. Thank you. (force pushes just to clean up the commit messages) |
0c3d91f
to
156aa73
Compare
156aa73
to
006e43a
Compare
Just for future reference future Stream support implementations may include all types of object. Example// don't mind the signature name
// notice the return has changed from JsonNode to String
public static Collector<String, ArrayNode, ArrayNode> someNewSignature(JsonNodeCreator nodeCreator) {
return Collector.of(
nodeCreator::arrayNode, // supplier
ArrayNode::add, // accumulator <---- every type supported by add can become a collector implementation now
ArrayNode::addAll // combiner
);
} Use-Case@Test
public void testToArrayNsode()
{
final ObjectMapper objectMapper = new ObjectMapper();
final JsonNode jsonNodeResult = IntStream.range(0, 10)
.mapToObj(i -> "Hello")
.collect(JacksonCollectors.toArrayNodeString());
System.out.println(jsonNodeResult);
} Output
|
JacksonCollectors
with toArrayNode()
implementation
Merged: thank you for contributing this, @rikkarth ! Will be in 2.18.0, to be released within week or so. |
Thank you, you were very supportive and nice, I really appreciate it. I intend to continue supporting you in the future. |
Glad this worked out very well; looking forward to our future collaboration @rikkarth ! |
See back reference: #4691
cc @cowtowncoder