Class CollectionComparator

java.lang.Object
de.xima.fc.certificate.ms.impl.util.CollectionComparator

public final class CollectionComparator extends Object
  • Method Details

    • areCollectionsEqual

      public static <T extends Comparable<T>> boolean areCollectionsEqual(Collection<T> collection1, Collection<T> collection2)
      Compares two collections of Comparable objects for equality based on compareTo() method. Two collections are considered equal if: - They have the same size - Each element in collection1 has a corresponding element in collection2 where compareTo() returns 0 - Each element is matched exactly once (handles duplicates correctly)
      Type Parameters:
      T - Type that implements Comparable
      Parameters:
      collection1 - First collection to compare
      collection2 - Second collection to compare
      Returns:
      true if collections contain the same elements, false otherwise