Skip to content

Commit d6e3b20

Browse files
authored
Make ArrayNode.elements() return ListIterator() (#4692)
1 parent 97d37dd commit d6e3b20

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

release-notes/VERSION-2.x

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@ Project: jackson-databind
1313
#2977: Incompatible `FAIL_ON_MISSING_PRIMITIVE_PROPERTIES` and
1414
field level `@JsonProperty`
1515
(reported by @GeorgiPetkov)
16+
#3120: Return `ListIterator` from `ArrayNode.elements()`
17+
(requested by @ludgerb)
18+
(fix by Joo-Hyuk K)
1619
#3241: `constructorDetector` seems to invalidate `defaultSetterInfo`
1720
for nullability
1821
(reported by @joca-bt)

src/main/java/com/fasterxml/jackson/databind/node/ArrayNode.java

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -246,9 +246,16 @@ public int size() {
246246
@Override // since 2.10
247247
public boolean isEmpty() { return _children.isEmpty(); }
248248

249+
/**
250+
* {@inheritDoc}
251+
*<p>
252+
* NOTE: actual underlying implementation returns {@link java.util.ListIterator}
253+
* from {@link java.util.List#listIterator()} that contains elements, since Jackson 2.18
254+
* (before was only generic {@link java.util.Iterator}).
255+
*/
249256
@Override
250257
public Iterator<JsonNode> elements() {
251-
return _children.iterator();
258+
return _children.listIterator();
252259
}
253260

254261
@Override

0 commit comments

Comments
 (0)