CollectionPattern<T> (final int size) { return with(new PatternCondition<Collection<T>>("size") { @Override public boolean accepts(final @NotNull Collection<T> collection, final ProcessingContext context) { return size == collection.size(); } }); }