Quantcast
Channel: Tuple unpacking inside map - Stack Overflow
Browsing all 2 articles
Browse latest View live

Answer by serejja for Tuple unpacking inside map

Are you looking for this?List(('x', 1), ('y', 2)).map { case (topic, partition) => topic}Edit: one more way to do the same, as @senia suggested:for { (topic, partition) <- List(('x', 1), ('y',...

View Article



Tuple unpacking inside map

I would like to unpack tuples inside map to access some of the values.In Python I would do it this way:>>> [topic for topic, partition in [('x', 1), ('y', 2)]]['x', 'y']Here tuples ('x', 1),...

View Article
Browsing all 2 articles
Browse latest View live


Latest Images