Skip to content

Add more remove methods for ArrayNode, ObjectNode [STEP-3] #4955

@cowtowncoder

Description

@cowtowncoder

(note: part of https://github.com/FasterXML/jackson-future-ideas/wiki/JSTEP-3)

Currently there is just one shared removal method for ArrayNode, ObjectNode, declared in ContainerNode:

 public abstract T removeAll();

So let's add some more:

  • T removeIf(Predicate<? super JsonNode>)
  • T removeNulls(): (short-cut for removeIf(JsonNode::isNull))

We could also consider clear() (similar to Collection), however, given there is already removeAll() let's not add that.

Also considered but not yet added:

  • T removeEmpty(): (short-cut for removeIf(JsonNode::isEmpty))

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions