Class Comparables


  • public class Comparables
    extends java.lang.Object
    Utilities for Comparable classes.
    Author:
    hakon
    • Constructor Summary

      Constructors 
      Constructor Description
      Comparables()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static <T extends java.lang.Comparable<? super T>>
      T
      max​(T first, T second)
      Returns the least element, or second if they are equal according to compareTo.
      static <T extends java.lang.Comparable<? super T>>
      T
      min​(T first, T second)
      Returns the least element, or first if they are equal according to compareTo.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • Comparables

        public Comparables()
    • Method Detail

      • min

        public static <T extends java.lang.Comparable<? super T>> T min​(T first,
                                                                        T second)
        Returns the least element, or first if they are equal according to compareTo.
      • max

        public static <T extends java.lang.Comparable<? super T>> T max​(T first,
                                                                        T second)
        Returns the least element, or second if they are equal according to compareTo.