insert method
Inserts a word into the trie with associated details. The details are stored at the end of the word.
Implementation
void insert(String word, T details) {
TrieNode<T> node = root;
for (int i = 0; i < word.length; i++) {
String char = word[i];
if (!node.children.containsKey(char)) {
node.children[char] = TrieNode<T>();
}
node = node.children[char]!;
}
node.isEndOfWord = true;
node.detailsSet.add(details);
}