Java Generics Comparator -


i coding java generics. want define binary tree class generically able take in class , , guarantee that class has comparator method compare(t o1, t o2) see whether need follow right or left subtree insert binary tree.

public class treedb <t implements comparator> {     //define binary tree methods } 

that best estimation of how force implement comparator method, compile throws error , don't know enough know wants.

try this

class treedb <t extends comparator<t>> { ... 

Comments

Popular posts from this blog

java.util.scanner - How to read and add only numbers to array from a text file -

rewrite - Trouble with Wordpress multiple custom querystrings -