public interface ComparisonStrategy
Modifier and Type | Method and Description |
---|---|
boolean |
areEqual(java.lang.Object actual,
java.lang.Object other)
Returns true if actual and other are equal according to the implemented comparison strategy.
|
boolean |
arrayContains(java.lang.Object array,
java.lang.Object value)
Returns true if given array contains given value according to the implemented comparison strategy, false otherwise.
|
java.lang.Iterable<?> |
duplicatesFrom(java.lang.Iterable<?> iterable)
Returns any duplicate elements from the given
Iterable according to the implemented comparison strategy. |
boolean |
isGreaterThan(java.lang.Object actual,
java.lang.Object other)
Returns true if actual is greater than other, false otherwise.
|
boolean |
isGreaterThanOrEqualTo(java.lang.Object actual,
java.lang.Object other)
Returns true if actual is greater than or equal to other, false otherwise.
|
boolean |
isLessThan(java.lang.Object actual,
java.lang.Object other)
Returns true if actual is less than other, false otherwise.
|
boolean |
isLessThanOrEqualTo(java.lang.Object actual,
java.lang.Object other)
Returns true if actual is less than or equal to other, false otherwise.
|
boolean |
isStandard()
Return true if comparison strategy is default/standard, false otherwise
|
boolean |
iterableContains(java.lang.Iterable<?> collection,
java.lang.Object value)
Returns true if given
Iterable contains given value according to the implemented comparison strategy, false
otherwise.If given Iterable is null, return false. |
void |
iterableRemoves(java.lang.Iterable<?> iterable,
java.lang.Object value)
Look for given value in given
Iterable according to the implemented comparison strategy, if value is found it is
removed from it.If given Iterable is null, does nothing. |
boolean |
stringContains(java.lang.String string,
java.lang.String sequence)
Returns true if given string contains given sequence according to the implemented comparison strategy, false otherwise.
|
boolean |
stringEndsWith(java.lang.String string,
java.lang.String suffix)
Returns true if sstring ends with suffix according to the implemented comparison strategy, false otherwise.
|
boolean |
stringStartsWith(java.lang.String string,
java.lang.String prefix)
Returns true if string starts with prefix according to the implemented comparison strategy, false otherwise.
|
boolean areEqual(java.lang.Object actual, java.lang.Object other)
actual
- the object to compare to otherother
- the object to compare to actualboolean isGreaterThan(java.lang.Object actual, java.lang.Object other)
actual
- the object to compare to otherother
- the object to compare to actualjava.lang.UnsupportedOperationException
- if operation is not supported by a concrete implementation.boolean isGreaterThanOrEqualTo(java.lang.Object actual, java.lang.Object other)
actual
- the object to compare to otherother
- the object to compare to actualjava.lang.UnsupportedOperationException
- if operation is not supported by a concrete implementation.boolean isLessThan(java.lang.Object actual, java.lang.Object other)
actual
- the object to compare to otherother
- the object to compare to actualjava.lang.UnsupportedOperationException
- if operation is not supported by a concrete implementation.boolean isLessThanOrEqualTo(java.lang.Object actual, java.lang.Object other)
actual
- the object to compare to otherother
- the object to compare to actualjava.lang.UnsupportedOperationException
- if operation is not supported by a concrete implementation.boolean iterableContains(java.lang.Iterable<?> collection, java.lang.Object value)
Iterable
contains given value according to the implemented comparison strategy, false
otherwise.Iterable
is null, return false.collection
- the Iterable
to search value invalue
- the object to look for in given Iterable
Iterable
contains given value according to the implemented comparison strategy, false
otherwise.void iterableRemoves(java.lang.Iterable<?> iterable, java.lang.Object value)
Iterable
according to the implemented comparison strategy, if value is found it is
removed from it.Iterable
is null, does nothing.iterable
- the Iterable
we want remove value fromvalue
- object to remove from given Iterable
java.lang.Iterable<?> duplicatesFrom(java.lang.Iterable<?> iterable)
Iterable
according to the implemented comparison strategy.iterable
- the given Iterable
we want to extract duplicate elements.Iterable
containing the duplicate elements of the given one. If no duplicates are found, an empty
Iterable
is returned.boolean arrayContains(java.lang.Object array, java.lang.Object value)
array
- the array to search value in (must not be null)value
- the object to look for in given arrayboolean stringContains(java.lang.String string, java.lang.String sequence)
string
- the string to search sequence in (must not be null)sequence
- the String to look for in given stringboolean stringStartsWith(java.lang.String string, java.lang.String prefix)
string
- the String we want to look starting prefixprefix
- the prefix String to look for at string's startboolean stringEndsWith(java.lang.String string, java.lang.String suffix)
string
- the String we want to look starting suffixsuffix
- the suffix String to look for at string's endboolean isStandard()