static <K, V, M extends Map<K, V>> M reject(M map, OfEntries<K, V, M> ofEntries, BiPredicate<? super K, ? super V> predicate) { Objects.requireNonNull(predicate, "predicate is null"); return filter(map, ofEntries, predicate.negate()); }
@Override public TextP negate() { return new TextP(this.biPredicate.negate(), this.originalValue); }
@Override public P<V> negate() { return new P<>(this.biPredicate.negate(), this.originalValue); }
@Override public <C extends PersistentCollection<T>, R> ReactiveSeq<R> groupedWhile(final BiPredicate<C, ? super T> predicate, final Supplier<C> factory, Function<? super C, ? extends R> finalizer) { return this.<R>createSeq(new GroupedStatefullyOperator<>(source, factory, finalizer, predicate.negate())); }
@Override public ReactiveSeq<Vector<T>> groupedWhile(final BiPredicate<Vector<? super T>, ? super T> predicate) { return createSeq(new GroupedStatefullyOperator<>(source, () -> Vector.empty(), Function.identity(), predicate.negate())); }
/** * Group data in a Stream using knowledge of the current batch and the next entry to determing grouping limits * * @see Traversable#groupedUntil(BiPredicate) * * @param stream Stream to group * @param predicate Predicate to determine grouping * @return Stream grouped into Lists determined by predicate */ public final static <T> Stream<Seq<T>> groupedStatefullyUntil(final Stream<T> stream, final BiPredicate<Seq<? super T>, ? super T> predicate) { return StreamSupport.stream(new GroupedStatefullySpliterator<>(stream.spliterator(),()->Seq.of(),Function.identity(),predicate.negate()),stream.isParallel()); }
@Override public ReactiveSeq<Vector<T>> groupedUntil(final BiPredicate<Vector<? super T>, ? super T> predicate) { return createSeq(new GroupedStatefullySpliterator<>(get(),()->Vector.empty(),Function.identity(), predicate.negate()), this.reversible); } @Override
@Override public <C extends PersistentCollection<T>,R> ReactiveSeq<R> groupedUntil(final BiPredicate<C, ? super T> predicate, final Supplier<C> factory, Function<? super C, ? extends R> finalizer) { return this.<R>createSeq(new GroupedStatefullySpliterator<T,C,R>(get(),factory,finalizer, predicate.negate()), this.reversible); }
@Property public <T, U> void negate(BiPredicate<T, U> p, T first, U second) { boolean result = p.test(first, second); assertEquals(!result, p.negate().test(first, second)); } }
static <K, V, M extends Map<K, V>> M reject(M map, OfEntries<K, V, M> ofEntries, BiPredicate<? super K, ? super V> predicate) { Objects.requireNonNull(predicate, "predicate is null"); return filter(map, ofEntries, predicate.negate()); }
@Override public TextP negate() { return new TextP(this.biPredicate.negate(), this.originalValue); }
@Override public <C extends PersistentCollection<T>, R> ReactiveSeq<R> groupedWhile(final BiPredicate<C, ? super T> predicate, final Supplier<C> factory, Function<? super C, ? extends R> finalizer) { return this.<R>createSeq(new GroupedStatefullyOperator<>(source, factory, finalizer, predicate.negate())); }
@Override public <C extends Collection<T>, R> ReactiveSeq<R> groupedStatefullyUntil(final BiPredicate<C, ? super T> predicate, final Supplier<C> factory, Function<? super C, ? extends R> finalizer) { return this.<R>createSeq(new GroupedStatefullyOperator<>(source, factory, finalizer, predicate.negate())); }
@Override public ReactiveSeq<ListX<T>> groupedStatefullyUntil(final BiPredicate<ListX<? super T>, ? super T> predicate) { return createSeq(new GroupedStatefullyOperator<>(source, () -> ListX.of(), Function.identity(), predicate.negate())); }
/** * Group data in a Stream using knowledge of the current batch and the next entry to determing grouping limits * * @see ReactiveSeq#groupedStatefullyUntil(BiPredicate) * * @param stream Stream to group * @param predicate Predicate to determine grouping * @return Stream grouped into Lists determined by predicate */ public final static <T> Stream<ListX<T>> groupedStatefullyUntil(final Stream<T> stream, final BiPredicate<ListX<? super T>, ? super T> predicate) { return StreamSupport.stream(new GroupedStatefullySpliterator<>(stream.spliterator(),()->ListX.of(),Function.identity(),predicate.negate()),stream.isParallel()); }
@Override public <C extends PersistentCollection<T>,R> ReactiveSeq<R> groupedUntil(final BiPredicate<C, ? super T> predicate, final Supplier<C> factory, Function<? super C, ? extends R> finalizer) { return this.<R>createSeq(new GroupedStatefullySpliterator<T,C,R>(get(),factory,finalizer, predicate.negate()), this.reversible); }
@Override public ReactiveSeq<ListX<T>> groupedStatefullyUntil(final BiPredicate<ListX<? super T>, ? super T> predicate) { return createSeq(new GroupedStatefullySpliterator<>(get(),()->ListX.of(),Function.identity(), predicate.negate()), this.reversible); } @Override
@Override public <C extends Collection<T>,R> ReactiveSeq<R> groupedStatefullyUntil(final BiPredicate<C, ? super T> predicate, final Supplier<C> factory, Function<? super C, ? extends R> finalizer) { return this.<R>createSeq(new GroupedStatefullySpliterator<T,C,R>(get(),factory,finalizer, predicate.negate()), this.reversible); }
@Override public ReactiveSeq<Vector<T>> groupedUntil(final BiPredicate<Vector<? super T>, ? super T> predicate) { return createSeq(new GroupedStatefullySpliterator<>(get(),()->Vector.empty(),Function.identity(), predicate.negate()), this.reversible); } @Override
/** * Returns a unary condition that returns true if the given step does not evaluate to true. * * @param step the condition to negate * @return the unary condition */ public static LogicalUnaryCondition negate(StepCondition step) { return new LogicalUnaryCondition(notMetadata(step.getMetadata()), (model, context) -> step.predicate().negate().test(model, context)); }