Record Class CollectionPredicate<T, P extends Predicate<T>>
java.lang.Object
java.lang.Record
net.minestom.server.instance.block.predicate.CollectionPredicate<T,P>
- Type Parameters:
T- Type of item in the collectionP- A Predicate that matches against items of typeT- Record Components:
contains- A set of sub-predicates which all must return true for this CollectionPredicate to return truecounts- A set of sub-predicates which all must match a certain number of times for this CollectionPredicate to return truesize- An acceptable range for the collection's size
- All Implemented Interfaces:
Predicate<Collection<T>>
public record CollectionPredicate<T, P extends Predicate<T>>(@Nullable CollectionPredicate.Contains<T, P extends Predicate<T>> contains, @Nullable CollectionPredicate.Count<T, P extends Predicate<T>> counts, Range.Int size)
extends Record
implements Predicate<Collection<T>>
A generic predicate to match against a collection of items.
If any fields are null, they are ignored in test(Collection). If all fields are null, test(Collection) returns true.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final classCollectionPredicate.Builder<T, P extends Predicate<T>>static final recordCollectionPredicate.Contains<T, P extends Predicate<T>>A predicate that requires that all of its sub-predicates match at least once.static final recordCollectionPredicate.Count<T, P extends Predicate<T>>A predicate that counts the number of matching sub-predicates and tests whether it's in thecountrange. -
Constructor Summary
ConstructorsConstructorDescriptionCollectionPredicate(@Nullable CollectionPredicate.Contains<T, P> contains, @Nullable CollectionPredicate.Count<T, P> counts, Range.Int size) Creates an instance of aCollectionPredicaterecord class. -
Method Summary
Modifier and TypeMethodDescriptionstatic <T, P extends Predicate<T>>
CollectionPredicate.Builder<T, P> builder()static <T, P extends Predicate<T>>
Codec<CollectionPredicate<T, P>> contains()Returns the value of thecontainsrecord component.counts()Returns the value of thecountsrecord component.final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.size()Returns the value of thesizerecord component.booleantest(Collection<T> collection) final StringtoString()Returns a string representation of this record class.
-
Constructor Details
-
CollectionPredicate
-
-
Method Details
-
codec
-
test
-
builder
@Contract(pure=true) public static <T, P extends Predicate<T>> CollectionPredicate.Builder<T,P> builder() -
toString
-
hashCode
-
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared withObjects::equals(Object,Object). -
contains
-
counts
-
size
-