@Override <R2> DistinctSpliterator<IN, ?> create(Function<? super IN, ? extends R2> after) { return new DistinctSpliterator(after, CopyableSpliterator.copy(source)); } }
@Override public void forEachRemaining(Consumer<? super T> action) { final Consumer<? super IN> toUse = apply(action); source.forEachRemaining(e->{ if(!values.contains(e)){ values.add(e); toUse.accept(e); } }); }
@Override public Spliterator<T> copy() { return new DistinctSpliterator<IN,T>(fn, CopyableSpliterator.copy(source)); }
@Override public boolean tryAdvance(Consumer<? super T> action) { final Consumer<? super IN> toUse = apply(action); boolean[] accepted = {false}; boolean advance = true; do { advance = source.tryAdvance(t -> { if (!values.contains(t)) { values.add(t); toUse.accept(t); accepted[0] = true; } }); }while(!accepted[0] && advance); return accepted[0] && advance; }
@Override public final ReactiveSeq<T> distinct() { return createSeq(new DistinctSpliterator<T,T>(get()), reversible); }
@Override public void forEachRemaining(Consumer<? super T> action) { final Consumer<? super IN> toUse = apply(action); source.forEachRemaining(e->{ if(!values.contains(e)){ values.add(e); toUse.accept(e); } }); }
@Override public Spliterator<T> copy() { return new DistinctSpliterator<IN,T>(fn, CopyableSpliterator.copy(source)); }
@Override public boolean tryAdvance(Consumer<? super T> action) { final Consumer<? super IN> toUse = apply(action); boolean[] accepted = {false}; boolean advance = true; do { advance = source.tryAdvance(t -> { if (!values.contains(t)) { values.add(t); toUse.accept(t); accepted[0] = true; } }); }while(!accepted[0] && advance); return accepted[0] && advance; }
@Override <R2> DistinctSpliterator<IN, ?> create(Function<? super IN, ? extends R2> after) { return new DistinctSpliterator(after, CopyableSpliterator.copy(source)); } }
@Override public final ReactiveSeq<T> distinct() { return createSeq(new DistinctSpliterator<T,T>(get()), reversible); }