BTree v4.0.0 Release NotesRelease Date: 2016-11-07 // about 6 years ago
🚀 This is a major release incorporating API-breaking changes. It also includes fixes for several high-severity bugs uncovered while working on new features, so this is a highly recommended upgrade.
💥 Breaking changes
⚡️ To support multiset operations, some of
BTree's methods have grown a new required parameter specifying the key matching strategy. To get the original behavior, specify
.groupingMatchesas the matching strategy, except for
union, as noted below. The compiler will provide fixits, but you'll still need to update the code by hand. This affects the following methods:
BTree.union(:)-- use the
.countingMatchesstrategy to get the original, multiset-appropriate, behavior.
BTree.distinctUnion(:)-- removed; use
🆕 New Features
SortedBagis a new generic collection implementing an ordered multiset.
BTreeMatchingStrategyis a new public enum for selecting one of two matching strategies when comparing elements from two trees with duplicate keys.
BTree.index(forInserting:at:)is a new method that returns the index at which a new element with the given key would be inserted into the tree.
SortedSet.indexOfFirstElement(after:)is a new method that finds the lowest index whose key is greater than the specified key.
SortedSet.indexOfFirstElement(notBefore:)is a new method that finds the lowest index whose key is greater than or equal to the specified key.
SortedSet.indexOfLastElement(before:)is a new method that finds the greatest index whose key is less than the specified key.
SortedSet.indexOfLastElement(notAfter:)is a new method that finds the greatest index whose key is less than or equal to the specified key.
🐛 Bug Fixes
- Issue #19: BTree concatenation, set operations sometimes corrupt their input trees
- 🔀 Issue #20: Corrupt BTree merge results when duplicate keys leak across common subtree boundaries
- Issue #21: BTree comparisons (subset/superset) may assert on certain shared subtrees
SortedSet.update(with:)now has a discardable result.