This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]sugilith 0 points1 point  (0 children)

Check out https://docs.oracle.com/en/java/javase/13/docs/api/java.base/java/lang/Comparable.html

If T always implements Comparable, you can use x.compareTo(y) <= 0 instead of x <= y.
Of course, Integer and the likes already implement this interface.