Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public static <T extends Comparable<?>> T max(T a, T b) {
- if (a == null) {
- if (b == null) return a;
- else return b;
- }
- if (b == null)
- return a;
- return a.compareTo(b) > 0 ? a : b;
- }
- The method compareTo(capture#5-of ?) in the type Comparable<capture#5-of ?> is not applicable for the arguments (T)
- <dependency>
- <groupid>org.softsmithy.lib</groupid>
- <artifactid>lib-core</artifactid>
- <version>0.1</version>
- </dependency>
- public static <T extends Comparable<T>> T max(T a, T b) {
- if (a == null) {
- if (b == null) return a;
- else return b;
- }
- if (b == null)
- return a;
- return a.compareTo(b) > 0 ? a : b;
- }
Add Comment
Please, Sign In to add comment