You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently use of Tree Model with Java 8 Streams is bit more complicated than necessary, since there are no java.util.stream.Stream producing methods in JsonNode. But it should be straight-forward at methods as follows:
Stream<JsonNode> JsonNode.valueStream(): for ArrayNode return Stream of all element JsonNodes; for ObjectNode return Stream of all values of child entries; for other nodes empty Stream
Stream<Map.Entry> JsonNode.propertyStream(): for ObjectNode return Stream of all properties (name, value pairs); for other nodes empty Stream
void JsonNode.forEachEntry(BiConsumer<String, JsonNode>): for ObjectNode calls consumer with all entries; for other nodes does nothing.
cowtowncoder
changed the title
Add basic Stream support in JsonNode: valueStream(), entryStream(), forEachEntry()
Add basic Stream support in JsonNode: valueStream(), propertyStream(), forEachEntry()Dec 28, 2024
(note: part of JSTEP-3 work)
Currently use of Tree Model with Java 8 Streams is bit more complicated than necessary, since there are no
java.util.stream.Stream
producing methods inJsonNode
. But it should be straight-forward at methods as follows:Stream<JsonNode> JsonNode.valueStream()
: forArrayNode
returnStream
of all elementJsonNode
s; forObjectNode
returnStream
of all values of child entries; for other nodes emptyStream
Stream<Map.Entry> JsonNode.propertyStream()
: forObjectNode
returnStream
of all properties (name, value pairs); for other nodes emptyStream
void JsonNode.forEachEntry(BiConsumer<String, JsonNode>)
: forObjectNode
calls consumer with all entries; for other nodes does nothing.In future we could also consider some of:
valueStream()
,propertyStream()
)But let's start with the simplest cases first.
The text was updated successfully, but these errors were encountered: