Skip to content

Commit

Permalink
signature rename to toJsonArray
Browse files Browse the repository at this point in the history
  • Loading branch information
rikkarth committed Sep 20, 2024
1 parent e56fd5b commit 0c3d91f
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,11 @@ public abstract class JacksonCollectors {
*
* @return a {@link Collector} that collects {@link JsonNode} elements into an {@link ArrayNode}
*/
public static Collector<JsonNode, ArrayNode, ArrayNode> toJsonNode() {
return toJsonNode(JsonNodeFactory.instance);
public static Collector<JsonNode, ArrayNode, ArrayNode> toJsonArray() {
return toJsonArray(JsonNodeFactory.instance);
}

public static Collector<JsonNode, ArrayNode, ArrayNode> toJsonNode(JsonNodeCreator nodeCreator) {
public static Collector<JsonNode, ArrayNode, ArrayNode> toJsonArray(JsonNodeCreator nodeCreator) {
return Collector.of(
nodeCreator::arrayNode, // supplier
ArrayNode::add, // accumulator
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
public class JacksonCollectorsTest {

@Test
public void testToJsonNode()
public void testToJsonArray()
{
final ObjectMapper objectMapper = new ObjectMapper();

Expand All @@ -25,7 +25,7 @@ public void testToJsonNode()

return objectNode;
})
.collect(JacksonCollectors.toJsonNode());
.collect(JacksonCollectors.toJsonArray());

assertEquals(10, jsonNodeResult.size());
jsonNodeResult.forEach(jsonNode -> assertFalse(jsonNode.isEmpty()));
Expand Down

0 comments on commit 0c3d91f

Please sign in to comment.