johnzon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From GitBox <>
Subject [GitHub] [johnzon] csaboka commented on a change in pull request #74: True object and array streaming
Date Sat, 10 Jul 2021 07:23:08 GMT

csaboka commented on a change in pull request #74:

File path: johnzon-core/src/main/java/org/apache/johnzon/core/
@@ -134,18 +140,57 @@ public void skipArray() {
     public Stream<JsonValue> getArrayStream() {
-        //X TODO this implementation is very simplistic
-        //X I find it unintuitive what the spec intends here
-        //X we probably need to improve this
-        return getArray().stream();
+        Event current = current();
+        if (current != Event.START_ARRAY) {
+            throw new IllegalStateException(current + " doesn't support getArrayStream()");
+        }
+        Spliterator<JsonValue> arraySpliterator = new Spliterators.AbstractSpliterator<JsonValue>(

Review comment:
       The generic arguments and the `tryAdvance()` implementations are different, so what
could be reused? As far as I can see, the only thing duplicated between the two Spliterator
implementations are the arguments passed to the superclass constructor. I can extract that
to a helper class if you'd like, but it feels overkill to me.

This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail:

For queries about this service, please contact Infrastructure at:

View raw message