generalize the Trie class to work for arrays as well as strings; handle nils