COLLECTIONS-873: create PatriciaTrieSet #589
Open
+581
−0
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
According to https://issues.apache.org/jira/browse/COLLECTIONS-873
MR is basically a draft or discussion of what to do.
I make PatriciaTrieSet based on PatriciaTrie under the hood.
Below I type what I don't like. Please give some advice.
The main problem is when I access PatriciaTrie, I have to return SortedSet.
But all collections under the hood of PatriciaTrie don't use SortedSet.
Thus, I wrap call under TreeSet.
For example
This is overwhelming because the keySet is already sorted, and adding to a TreeSet also takes time.
To improve the situation, I make two approaches:
The drawback is that a change (bug) in bit operations leads to a rewrite in PatriciaTrieSet and PatriciaTrie independently.
public interface NavigableMap<K,V> extends SortedMap<K,V>
From NavigableMap, I can get navigableKeySet and work with it in PatriciaTrieSet.