ComparisonStrategy contract with a comparison strategy based on a Comparator.
| Modifier and Type | Field and Description |
|---|---|
| private final Comparator | |
| private final String | |
| pack-priv static final int |
| Access | Constructor and Description |
|---|---|
| public | ComparatorBasedComparisonStrategy(Comparator<T>
the comparison strategy to use. comparator)Creates a new |
| public | ComparatorBasedComparisonStrategy(Comparator<T>
the comparison strategy to use. comparator, String the comparator description to use in assertion messages. comparatorDescription)Creates a new |
| public | ComparatorBasedComparisonStrategy(DescribableComparator<?>
the comparator to use in the comparison strategy. comparator)Creates a new |
| Modifier and Type | Method and Description |
|---|---|
| public boolean | Returns: true if actual and other are equal according tocomparator, false otherwise.the object to compare to other actual, Object the object to compare to actual other)Implements org. comparator, false otherwise.
|
| public String | asText()
Overrides default org. |
| public Iterable | duplicatesFrom(Iterable<?>
the given iterable)Iterable we want to extract duplicate elements.Overrides org. Implements org. Iterable according to comparator.
|
| public Comparator | |
| public String | |
| public boolean | isGreaterThan(Object
the object to compare to other actual, Object the object to compare to actual other)Implements org. |
| public boolean | isStandard()
Overrides org. Implements org. |
| public boolean | iterableContains(Iterable<?>
the iterable, Object Iterable to search value inthe object to look for in given value)IterableImplements org. Iterable contains given value according to comparator, false otherwise.
|
| public void | iterableRemoves(Iterable<?>
the iterable, Object Iterable we want remove value fromobject to remove from given value)IterableImplements org. Iterable according to the Comparator, if value is found it is removed
from it.
|
| public void | iterablesRemoveFirst(Iterable<?>
the iterable, Object Iterable we want remove value fromobject to remove from given value)IterableImplements org. iterable that matches the value according to the implemented comparison
strategy.
|
| protected Set | newSetUsingComparisonStrategy()
Implements abstract org. Set honoring the comparison strategy used.
|
| public boolean | stringContains(String
the string to search sequence in (must not be null) string, String the String to look for in given string sequence)Implements org. |
| public boolean | stringEndsWith(String
the String we want to look starting suffix string, String the suffix String to look for at string's end suffix)Implements org. |
| public boolean | stringStartsWith(String
the String we want to look starting prefix string, String the prefix String to look for at string's start prefix)Implements org. |
| public String |
| comparator | back to summary |
|---|---|
private final Comparator<T> comparator
| |
| comparatorDescription | back to summary |
|---|---|
| private final String comparatorDescription | |
| NOT_EQUAL | back to summary |
|---|---|
| pack-priv static final int NOT_EQUAL | |
| ComparatorBasedComparisonStrategy | back to summary |
|---|---|
| public ComparatorBasedComparisonStrategy(Comparator<T> comparator) Creates a new
| |
| ComparatorBasedComparisonStrategy | back to summary |
|---|---|
| public ComparatorBasedComparisonStrategy(Comparator<T> comparator, String comparatorDescription) Creates a new
| |
| ComparatorBasedComparisonStrategy | back to summary |
|---|---|
| public ComparatorBasedComparisonStrategy(DescribableComparator<?> comparator) Creates a new
| |
| areEqual | back to summary |
|---|---|
| public boolean areEqual(Object actual, Object other) Implements org. Returns true if actual and other are equal according to
| |
| asText | back to summary |
|---|---|
| public String asText() Overrides default org. Doc from org. Used in error messages when a custom comparison strategy was used to compare values.
For example
| |
| duplicatesFrom | back to summary |
|---|---|
| public Iterable Overrides org. Implements org. Returns any duplicate elements from the given | |
| getComparator | back to summary |
|---|---|
| public Comparator | |
| getComparatorDescription | back to summary |
|---|---|
| public String getComparatorDescription() | |
| isGreaterThan | back to summary |
|---|---|
| public boolean isGreaterThan(Object actual, Object other) Implements org. Doc from org. Returns true if actual is greater than other, false otherwise.
| |
| isStandard | back to summary |
|---|---|
| public boolean isStandard() Overrides org. Implements org. Doc from org. Return true if comparison strategy is default/standard, false otherwise
| |
| iterableContains | back to summary |
|---|---|
| public boolean iterableContains(Iterable<?> iterable, Object value) Implements org. Returns true if given
| |
| iterableRemoves | back to summary |
|---|---|
| public void iterableRemoves(Iterable<?> iterable, Object value) Implements org. Look for given value in given | |
| iterablesRemoveFirst | back to summary |
|---|---|
| public void iterablesRemoveFirst(Iterable<?> iterable, Object value) Implements org. Doc from org. Removes the first value in | |
| newSetUsingComparisonStrategy | back to summary |
|---|---|
| protected Set Implements abstract org. Doc from org. Returns a
| |
| stringContains | back to summary |
|---|---|
| public boolean stringContains(String string, String sequence) Implements org. Doc from org. Returns true if given string contains given sequence according to the implemented comparison strategy, false otherwise. | |
| stringEndsWith | back to summary |
|---|---|
| public boolean stringEndsWith(String string, String suffix) Implements org. Doc from org. Returns true if string ends with suffix according to the implemented comparison strategy, false otherwise.
| |
| stringStartsWith | back to summary |
|---|---|
| public boolean stringStartsWith(String string, String prefix) Implements org. Doc from org. Returns true if string starts with prefix according to the implemented comparison strategy, false otherwise.
| |
| toString | back to summary |
|---|---|
| public String toString() Overrides java. Doc from java. Returns a string representation of the object. | |