public enum Contains extends Enum<Contains> implements BiPredicate<Object,Collection>
Contains
is a BiPredicate
that evaluates whether the first object is contained within (or not
within) the second collection object. If the first object is a number, each element in the second collection
will be compared to the first object using Compare
's eq
predicate. This will ensure, that numbers
are matched by their value only, ignoring the number type. For example:
gremlin Contains.within [gremlin, blueprints, furnace] == true gremlin Contains.without [gremlin, rexster] == false rexster Contains.without [gremlin, blueprints, furnace] == true 123 Contains.within [1, 2, 3] == false 100 Contains.within [1L, 10L, 100L] == true
Enum Constant and Description |
---|
within
The first object is within the
Collection provided in the second object. |
without
The first object is not within the
Collection provided in the second object. |
Modifier and Type | Method and Description |
---|---|
Contains |
negate()
Produce the opposite representation of the current
Contains enum. |
abstract boolean |
test(Object first,
Collection second) |
static Contains |
valueOf(String name)
Returns the enum constant of this type with the specified name.
|
static Contains[] |
values()
Returns an array containing the constants of this enum type, in
the order they are declared.
|
clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf
and, or
public static final Contains within
Collection
provided in the second object. The second object may not be
null
.public static final Contains without
Collection
provided in the second object. The second object may not be
null
.public static Contains[] values()
for (Contains c : Contains.values()) System.out.println(c);
public static Contains valueOf(String name)
name
- the name of the enum constant to be returned.IllegalArgumentException
- if this enum type has no constant with the specified nameNullPointerException
- if the argument is nullpublic abstract boolean test(Object first, Collection second)
test
in interface BiPredicate<Object,Collection>
public Contains negate()
Contains
enum.negate
in interface BiPredicate<Object,Collection>
Copyright © 2013–2023 Apache Software Foundation. All rights reserved.