0

FluentIterable.index returns an ImmutableListMultimap, which ceases to be fluent. That means if I want to transform the existing map I will have to wrap the entire thing in another FluentIterable again, and the ugliness that results defeats the purpose of being fluent.

FluentIterable.from(
    FluentIterable
        .from(list)
        .index(...)
        .asMap().entrySet()) // this is less than ideal too
        // Ideally I want to transform here so that I don't need the other .from call
    .transform(....)

Is there a more fluent way to achieve this with guava? (without Java 8)

Coder
  • 1,917
  • 3
  • 17
  • 33
user69715
  • 825
  • 9
  • 15
  • I'll probably get a lot of down-votes if I post this as the answer so I'll just post it here as a comment: If you want fluent iterables, lists, maps, sets, etc. for the JDK then you might be better off using a different JVM language (e.g. [Kotlin](https://kotlinlang.org/)). – mfulton26 Jan 27 '17 at 15:09
  • @mfulton26: Kotlin's great, but if the OP can't use Java 8 (which also has these features) they're probably not going to be able to use Kotlin either. – ColinD Jan 27 '17 at 19:19

0 Answers0