Reputation: 1971
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?
Upvotes: 0
Views: 641
Reputation: 1971
Thanks to @karelss
This is the solution:
List<Tuple2<Double, Integer>> list = new ArrayList<Tuple2<Double, Integer>>();
list.add(...);
Collector<Tuple2<Double, Integer>> data = new ListCollector<>(list);
Upvotes: 1
Reputation: 1762
Try to use this ListCollector as bridge, with this class you can translate your List (ArrayList) into a Collector(ListCollector), using the constructor
Upvotes: 1