Guest User

Untitled

a guest
Jul 17th, 2018
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.69 KB | None | 0 0
  1. public static <T extends Comparable<?>> T max(T a, T b) {
  2. if (a == null) {
  3. if (b == null) return a;
  4. else return b;
  5. }
  6. if (b == null)
  7. return a;
  8. return a.compareTo(b) > 0 ? a : b;
  9. }
  10.  
  11. The method compareTo(capture#5-of ?) in the type Comparable<capture#5-of ?> is not applicable for the arguments (T)
  12.  
  13. <dependency>
  14. <groupid>org.softsmithy.lib</groupid>
  15. <artifactid>lib-core</artifactid>
  16. <version>0.1</version>
  17. </dependency>
  18.  
  19. public static <T extends Comparable<T>> T max(T a, T b) {
  20. if (a == null) {
  21. if (b == null) return a;
  22. else return b;
  23. }
  24. if (b == null)
  25. return a;
  26. return a.compareTo(b) > 0 ? a : b;
  27. }
Add Comment
Please, Sign In to add comment