neer1304 / concurrent-trees

Automatically exported from code.google.com/p/concurrent-trees
0 stars 0 forks source link

ConcurrentSuffixTree.getKeysEndingWith(x) returns null when x is empty #10

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Create a ConcurrentSuffixTree
2. Insert some keys
3. Attempt to retrieve all keys by using .getKeysEndingWith("")

What is the expected output? What do you see instead?
I expect an iterable with all keys; I get null. 

What version of the product are you using? On what operating system?
2.4.0 on  Java 1.8.0_20

Please provide any additional information below.
.getKeysStartingWith("") and .getKeysEndingWith("") return all keys for 
ConcurrentRadixTree and ConcurrentReversedRadixTree respectively.

Original issue reported on code.google.com by m...@domkm.com on 25 Oct 2014 at 9:30

GoogleCodeExporter commented 9 years ago
Hi, I could not reproduce that. It never returns null. I think you mean you get 
an iterable which does not provide any keys. It's an important distinction!

For the ConcurrentSuffixTree,
getKeysEndingWith("") returns a non-null iterable which provides no keys.
getKeysContaining("") returns a non-null iterable which provides all keys in 
the tree.

The mechanism to get all keys from the various types of tree, depends on the 
type of the tree. These differences are not bugs. I agree they're inconsistent 
but this is due to the nature of the trees. To get all keys you can call:

RadixTree.getKeysStartingWith("")
ReversedRadixTree.getKeysEndingWith("")
SuffixTree.getKeysContaining("")

Original comment by ni...@npgall.com on 25 Nov 2014 at 11:28