spark-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From robertrichter <>
Subject restructure key-value pair with lambda in java
Date Tue, 25 Nov 2014 11:54:11 GMT
I have a key value pair, whose value is an ArrayList and I would like to
move one value of the ArrayList to the key position and the key back into
the ArrayList. Is it possible to do tis with java lambda expression?

This workes in python:
newMap = (key,((value1, value2), value3)) : (value1,
(key, value2,value3)))

I resolved this in Java with the abstract "call" method, but is there a way
to do this with lambda expression, to reduce the number of lines needed?

JavaPairRDD<String, ArrayList&lt;String>> newMap=
sourceMap.flatMapToPair((String a, ArrayList<String> b) -> ??? 

Thank you for any suggestions

View this message in context:
Sent from the Apache Spark User List mailing list archive at

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message