ekuvardin opened a new pull request, #589:
URL: https://github.com/apache/commons-collections/pull/589

   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
   
   ```
   @Override
       public SortedSet<String> headSet(String toElement) {
           return new TreeSet<>(trie.headMap(toElement).keySet());
       }
   ```
   
   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:
   
   1. Fully rewrite PatriciaTrieSet, copying logic with bit operations to the 
corresponding class.
   The drawback is that a change (bug) in bit operations leads to a rewrite in 
PatriciaTrieSet and PatriciaTrie independently.
   2. Extend the internal PatricaiTrie class to implement NavigableMap 
(PrefixRangeMap and RangeEntryMap + some other classes).
   `public interface NavigableMap<K,V> extends SortedMap<K,V> `
   From NavigableMap, I can get navigableKeySet and work with it in 
PatriciaTrieSet.
   


-- 
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]

Reply via email to