Skip to content

Commit

Permalink
add propertyNamesSpliterator (#1369)
Browse files Browse the repository at this point in the history
  • Loading branch information
pjfanning authored Dec 28, 2024
1 parent c1b8069 commit 9af646d
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions src/main/java/tools/jackson/core/TreeNode.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
package tools.jackson.core;

import java.util.Iterator;
import java.util.Spliterator;
import java.util.Spliterators;

/**
* Marker interface used to denote JSON Tree nodes, as far as
Expand Down Expand Up @@ -227,6 +229,19 @@ public interface TreeNode
*/
Iterator<String> propertyNames();

/**
* Method for accessing names of all properties for this node via a <code>Spliterator</code> ,
* if (and only if) this node is an Object node. Number of property names accessible
* will be {@link #size}.
*
* @return A <code>Spliterator</code> for traversing names of all properties this Object node
* has (if Object node); empty {@link Spliterator} otherwise (never {@code null}).
* @since 3.0
*/
default Spliterator<String> propertyNamesSpliterator() {
return Spliterators.spliteratorUnknownSize(propertyNames(), Spliterator.ORDERED);
}

/**
* Method for locating node specified by given JSON pointer instances.
* Method will never return null; if no matching node exists,
Expand Down

0 comments on commit 9af646d

Please sign in to comment.