Class CollectionComparator
- java.lang.Object
-
- de.xima.fc.certificate.ms.impl.util.CollectionComparator
-
public final class CollectionComparator extends Object
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static <T extends Comparable<T>>
booleanareCollectionsEqual(Collection<T> collection1, Collection<T> collection2)Compares two collections of Comparable objects for equality based on compareTo() method.
-
-
-
Method Detail
-
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 comparecollection2- Second collection to compare- Returns:
- true if collections contain the same elements, false otherwise
-
-