spmallette commented on code in PR #3448: URL: https://github.com/apache/tinkerpop/pull/3448#discussion_r3389080167
########## docs/src/upgrade/release-4.x.x.asciidoc: ########## @@ -501,10 +501,49 @@ It cannot be passed to `traversal().with(...)`, and mutating its collections has re-query elements against the original graph, extract their ids and call `g.V(id)` or `g.E(id)` against the original `GraphTraversalSource`. +==== Tree No Longer Extends HashMap + +`Tree` no longer extends `HashMap`. It is now a `final` class that holds a `Map` internally and exposes a +tree-shaped API instead of `Map` methods. This is a breaking change for code that treated a `tree()` result as a +`Map`. + +Replacements for the common `Map`-based access patterns: + +[options="header"] +|======================= +|3.x (`Tree` as `Map`) |4.x (`Tree` API) +|`tree.get(key)` |`tree.childAt(key)` (throws if absent) or `tree.findSubtree(key)` (recursive, returns `Optional`) +|`tree.containsKey(key)` |`tree.hasChild(key)` +|`tree.keySet()` |`tree.rootNodes()` +|`tree.size()` |`tree.rootNodes().size()` for root entries, or `tree.nodeCount()` for total nodes +|`getObjectsAtDepth(d)` |`getNodesAtDepth(d)` (now 0-based: depth 0 returns the roots) Review Comment: i know we wanted more tree terminology so we moved from "Objects" to "Node", but it just occurred to me that the return here isn't exactly a "node", is it? I wonder if that will be confusing. -- 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: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
