functionalj.functions.RegExMatchResultStream Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of functionalj-core Show documentation
Show all versions of functionalj-core Show documentation
The module for FunctionalJ Core.
package functionalj.functions;
import static functionalj.functions.RegExMatchResult.theResults;
import java.util.Collection;
import java.util.function.Consumer;
import java.util.function.Function;
import java.util.function.Predicate;
import java.util.stream.Stream;
import functionalj.function.IntObjBiFunction;
import functionalj.stream.StreamPlus;
@FunctionalInterface
public interface RegExMatchResultStream extends StreamPlus {
public static final RegExMatchResultStream empty = RegExMatchResultStream.from(StreamPlus.empty());
public static RegExMatchResultStream from(Stream stream) {
if (stream == null)
return empty;
if (stream instanceof RegExMatchResultStream)
return (RegExMatchResultStream)stream;
return (RegExMatchResultStream)(()->StreamPlus.from(stream));
}
public StreamPlus stream();
public default StreamPlus toTexts() {
return pipeTo(theResults.texts);
}
//-- Filter --
public default RegExMatchResultStream filter(Predicate super RegExMatchResult> predicate) {
return (RegExMatchResultStream)(()->stream().filter(predicate));
}
public default RegExMatchResultStream filterNonNull() {
return (RegExMatchResultStream)(()->stream().filterNonNull());
}
public default RegExMatchResultStream filterIn(Collection super RegExMatchResult> collection) {
return (RegExMatchResultStream)(()->stream().filterIn(collection));
}
public default RegExMatchResultStream exclude(Predicate super RegExMatchResult> predicate) {
return (RegExMatchResultStream)(()->stream().exclude(predicate));
}
public default RegExMatchResultStream excludeIn(Collection super RegExMatchResult> collection) {
return (RegExMatchResultStream)(()->stream().excludeIn(collection));
}
public default RegExMatchResultStream filter(Class clzz) {
return (RegExMatchResultStream)(()->stream().filter(clzz));
}
public default RegExMatchResultStream filter(Class clzz, Predicate super T> theCondition) {
return (RegExMatchResultStream)(()->stream().filter(clzz, theCondition));
}
public default RegExMatchResultStream filter(Function super RegExMatchResult, T> mapper, Predicate super T> theCondition) {
return (RegExMatchResultStream)(()->stream().filter(mapper, theCondition));
}
public default RegExMatchResultStream filterWithIndex(IntObjBiFunction super RegExMatchResult, Boolean> predicate) {
return (RegExMatchResultStream)(()->stream().filterWithIndex(predicate));
}
//-- Peek --
public default RegExMatchResultStream peek(Consumer super RegExMatchResult> action) {
return (RegExMatchResultStream)(()->stream().peek(action));
}
public default RegExMatchResultStream peek(Class clzz, Consumer super T> theConsumer) {
return (RegExMatchResultStream)(()->stream().peek(clzz, theConsumer));
}
public default RegExMatchResultStream peekBy(Predicate super RegExMatchResult> selector, Consumer super RegExMatchResult> theConsumer) {
return (RegExMatchResultStream)(()->stream().peekBy(selector, theConsumer));
}
public default RegExMatchResultStream peekAsObj(Function super RegExMatchResult, T> mapper, Consumer super T> theConsumer) {
return (RegExMatchResultStream)(()->stream().peekAs(mapper, theConsumer));
}
public default RegExMatchResultStream peekAs(Function super RegExMatchResult, T> mapper, Predicate super T> selector, Consumer super T> theConsumer) {
return (RegExMatchResultStream)(()->stream().peekAs(mapper, theConsumer));
}
}