Search code examples
javascalafunctional-programmingguava

What is the Guava equivalent of Scala's flatMap?


Looking through https://github.com/google/guava/wiki/FunctionalExplained I see operations like transform, which will transform a list but keep the same cardinality. How can I perform a transform that results in a different cardinality? e.g. (pseudocode) List(1,2,3).transform(i => List(i, i)) -> List(1,1,2,2,3,3)


Solution

  • As of version 13, there is transformAndConcat on FluentIterable.