I have this bit of code, and it continues to say that it cannot create a shared array, but I don't have one in the Node class, just in the Object field. The Node class is an inner class. Why is he doing this?
public class TernarySearchTrie<E> implements TrieInterface<E> { private Node[] root = new Node[256]; private int size = 0; private class Node { char c; Node left, mid, right; Object value; } }
Add the modifier staticto the Node class:
static
private static class Node { char c; Node left, mid, right; Object value; }
Without static, it depends on the TernarySearchTrie class, which has generics.
What are you new Node[256]really doing in the problem TernarySeachTrie<E>.Node[256]. One solution is to use the raw type:
new Node[256]
TernarySeachTrie<E>.Node[256]
Node[] root = TernarySearchTrie.Node[256];
Of course, the compiler gives you a warning for this.