I have written my own 2-3-4 tree in java. Currently, my code looks like this:
public class tree234{
private class node{
Comparable data[]=new Comparable[3];
node next[]=new node[4];
}
}
Instead, I'd like to have something like this:
public class tree234<T extends Comparable<? super T>>{
private class node{
T[] data=new T[3];//error here!
node[] next=new node[4];
}
}
While I understand that I cannot create the array (and sort of understand why), I can't think of a reasonably simple way to implement the node class with generics. Any suggestions?