spark-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From robertrichter <robert.richter...@gmail.com>
Subject restructure key-value pair with lambda in java
Date Tue, 25 Nov 2014 11:54:11 GMT
Hello,
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 = sourceMap.map(lambda (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
Rob



--
View this message in context: http://apache-spark-user-list.1001560.n3.nabble.com/restructure-key-value-pair-with-lambda-in-java-tp19748.html
Sent from the Apache Spark User List mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@spark.apache.org
For additional commands, e-mail: user-help@spark.apache.org


Mime
View raw message