Class CollectionComparator<T>
- java.lang.Object
-
- psidev.psi.mi.jami.utils.comparator.CollectionComparator<T>
-
- All Implemented Interfaces:
Comparator<Collection<? extends T>>
- Direct Known Subclasses:
AliasesCollectionComparator
,AnnotationsCollectionComparator
,CooperativityEvidenceCollectionComparator
,CvTermsCollectionComparator
,FeatureCollectionComparator
,ModelledInteractionCollectionComparator
,ModelledParticipantCollectionComparator
,ParameterCollectionComparator
,ParticipantCollectionComparator
,RangeCollectionComparator
,VariableParameterCollectionComparator
,VariableParameterValueCollectionComparator
,VariableParameterValueSetCollectionComparator
,XrefsCollectionComparator
public class CollectionComparator<T> extends Object implements Comparator<Collection<? extends T>>
A comparator for collections. Two collections are equals if they have the same content and the same size. The smallest collection will come before the longest collection.- Since:
20/12/12
- Version:
- $Id$
- Author:
- Marine Dumousseau (marine@ebi.ac.uk)
-
-
Constructor Summary
Constructors Constructor Description CollectionComparator(Comparator<T> objectComparator)
Creates a new CollectionComparator.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description int
compare(Collection<? extends T> ts1, Collection<? extends T> ts2)
Two collections are equals if they have the same content and the same size.Comparator<T>
getObjectComparator()
Getter for the fieldobjectComparator
.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface java.util.Comparator
equals, reversed, thenComparing, thenComparing, thenComparing, thenComparingDouble, thenComparingInt, thenComparingLong
-
-
-
-
Constructor Detail
-
CollectionComparator
public CollectionComparator(Comparator<T> objectComparator)
Creates a new CollectionComparator. It requires a Comparator for the obejcts in the Collection- Parameters:
objectComparator
- aComparator
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 interfaceComparator<T>
- Parameters:
ts1
- aCollection
object.ts2
- aCollection
object.- Returns:
- a int.
-
-