java - Trying to learn generics, is there a way to see if one generic object is bigger or smaller then another? -


i thought nice use generics write quick sort. i'm learning generics, , seems can test whether 1 generic value equal another. there way see if 1 greater another? wrote simple isbig method follows

public boolean  isbigger( t b) {         if (b>x) // error message here             return true;          return false; } 

public static <t extends comparable<? super t>> boolean isbigger(t x, t y) {   return x != null && (y == null || x.compareto(y) > 0); }  public static <t> boolean isbigger(t x, t y, comparator<? super t> cmp) {   return cmp.compare(x, y) > 0; } 

Comments

Popular posts from this blog

python - mat is not a numerical tuple : openCV error -

c# - MSAA finds controls UI Automation doesn't -

wordpress - .htaccess: RewriteRule: bad flag delimiters -