lidox lidox - 9 months ago 78
Java Question

Convert a List / Map to org.apache.flink.util.Collector

How can I convert a List / Map to org.apache.flink.util.Collector?

Lets say I have this:

List<Tuple2<Double, Integer>> list = new ArrayList<Tuple2<Double, Integer>>();

And I want to get something like this:

Collector<Tuple2<Double, Integer>> data = ... list.getCollector();

Any Ideas?

Answer Source

Try to use this ListCollector as bridge, with this class you can translate your List (ArrayList) into a Collector(ListCollector), using the constructor