I'm implementing a B-tree for a Java database job, so that it saves any object types, whether it's generic, so I'm treating it like it's Object
, but in some precise code snippets of methods as compareTo()
, which should be implemented, but the generic class does not provide them. What solution can I adopt?
I have the following method:
public void add (Object o){
Node aux = addRecursive (this.raiz, o);
...
}
How to force the Object o
parameter to implement the Comparable
interface.