T - type of the input itemR - type of the emitted itemprotected final class AbstractProcessor.FlatMapper<T,R> extends Object
tryProcess() for emitting
collections. User supplies a mapper which takes an item and
returns a traverser over all output items that should be emitted. The
tryProcess(Object) method obtains and passes the traverser to
AbstractProcessor.emitCooperatively(int, Traverser).
Example:
public static class SplitWordsP extends AbstractProcessor {
private FlatMapper<String, String> flatMapper =
flatMapper((String item) -> Traverser.over(item.split("\\W")));
@Override
protected boolean tryProcess(int ordinal, Object item) throws Exception {
return flatMapper.tryProcess((String) item);
}
}| Modifier and Type | Method and Description |
|---|---|
boolean |
tryProcess(T item)
Method designed to be called from one of
AbstractProcessor#tryProcessX()
methods. |
Copyright © 2017 Hazelcast, Inc.. All Rights Reserved.