Create Java 8 Stream from ArrayNode

前端 未结 2 1206
Happy的楠姐
Happy的楠姐 2021-02-12 06:04

Is it possible to create stream from com.fasterxml.jackson.databind.node.ArrayNode?
I tried:

ArrayNode files = (ArrayNode) json.get(\"files\")         


        
2条回答
  •  遇见更好的自我
    2021-02-12 06:48

    ArrayNode implements Iterable. Iterable has a spliterator() method. You can create a sequential Stream from a Spliterator using

    StreamSupport.stream(spliterator, false)
    

提交回复
热议问题