Class CollectionComparator<T>

    • Constructor Detail

      • CollectionComparator

        public CollectionComparator​(Comparator<T> objectComparator)
        Creates a new CollectionComparator. It requires a Comparator for the obejcts in the Collection
        Parameters:
        objectComparator - a Comparator object.
    • Method Detail

      • getObjectComparator

        public Comparator<T> getObjectComparator()

        Getter for the field objectComparator.

        Returns:
        a Comparator object.
      • compare

        public int compare​(Collection<? extends T> ts1,
                           Collection<? extends T> ts2)
        Two collections are equals if they have the same content and the same size. The smallest collection will come before the longest collection.
        Specified by:
        compare in interface Comparator<T>
        Parameters:
        ts1 - a Collection object.
        ts2 - a Collection object.
        Returns:
        a int.