Is it possible to create stream from com.fasterxml.jackson.databind.node.ArrayNode?
I tried:
ArrayNode files = (ArrayNode) json.get("files"); Stream<JsonNode> stream = Stream.of(files); But it will actually give stream of one element, the initial ArrayNode object.
Correct result should be Stream<JsonNode>, can I achieve it?
ArrayNode implements Iterable. Iterable has a spliterator() method. You can create a sequential Stream from a Spliterator using
StreamSupport.stream(spliterator, false)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With