use of com.ibm.streamsx.topology.function.Predicate in project streamsx.topology by IBMStreams.
the class StreamImpl method filter.
@Override
public TStream<T> filter(Predicate<T> filter) {
String opName = LogicUtils.functionName(filter);
BOperatorInvocation bop = JavaFunctional.addFunctionalOperator(this, opName, FILTER_KIND, filter).layoutKind("Filter");
SourceInfo.setSourceInfo(bop, StreamImpl.class);
connectTo(bop, true, null);
return addMatchingOutput(bop, refineType(Predicate.class, 0, filter));
}
use of com.ibm.streamsx.topology.function.Predicate in project streamsx.topology by IBMStreams.
the class AutoTypeTest method _testStringListAutoTypedByFilter.
private static void _testStringListAutoTypedByFilter() {
Topology t = newTopology();
TStream<String> strings = t.constants(Collections.nCopies(10, "hello"));
strings = strings.filter(new Predicate<String>() {
@Override
public boolean test(String tuple) {
return false;
}
});
assertEquals(String.class, strings.getTupleClass());
assertEquals(String.class, strings.getTupleType());
}
Aggregations