Package uk.ac.ebi.utils.collections
Class ArraySearchUtils
java.lang.Object
uk.ac.ebi.utils.collections.ArraySearchUtils
Utilities about searches over arrays.
- date
- 25 Sep 2013
- Author:
- Marco Brandizi
-
Method Summary
Modifier and TypeMethodDescriptionstatic <T extends Comparable<? super T>>
booleanisOneOf
(T value, Comparator<T> comparator, T... testValues) Tells if a value is equals to one of the values specified in an array.static <T extends Comparable<? super T>>
booleanisOneOf
(T value, T... testValues) A variant ofinvalid reference
#isOneOf(Object, Comparator, Object...)
static <T extends Comparable<? super T>>
booleanisOneOfByIdentity
(T value, T... testValues) A variant ofinvalid reference
#isOneOf(Object, Comparator, Object...)
-
Method Details
-
isOneOf
@SafeVarargs public static <T extends Comparable<? super T>> boolean isOneOf(T value, Comparator<T> comparator, T... testValues) Tells if a value is equals to one of the values specified in an array. This is different than similar functions, eg,ArrayUtils.contains(Object[], Object)
, in the fact that the search can be based on a comparator.- Parameters:
value
- the value to check, if it is null, the method returns null in case comparator.compare ( null, null ) returns 0 and testValues contains null.comparator
- the comparator to be used for equality test. Note that what this returns when two values are different isn't relevant here.invalid reference
#isOneOf(Object, Object...)
invalid reference
#isOneOfByIdentity(Object, Object...)
testValues
- the values that the target parameter has to be compared to
-
isOneOf
@SafeVarargs public static <T extends Comparable<? super T>> boolean isOneOf(T value, T... testValues) A variant ofinvalid reference
#isOneOf(Object, Comparator, Object...)
-
isOneOfByIdentity
A variant ofinvalid reference
#isOneOf(Object, Comparator, Object...)
-