Iterate over Guava ImmutableList in Scala -
i'm having trouble iterating on immutablelist guava in scala. reason i'm working them because i'm working code written in java uses guava api. however, compiler doesn't seem it. here's code:
for (blockdata: iblockdata <- block.p.a) { *insert actions here* } the compiler errors this:
error:(24, 43) value filter not member of com.google.common.collect.immutablelist[net.minecraft.server.v1_8_r3.iblockdata] (blockdata: iblockdata <- block.p.a) { ^ any appreciated. thanks!
to use scalas for expression object has implement flatmap , filter guava collections not. scala comes bundled java converters, should work:
import collection.javaconverters._ (blockdata: iblockdata <- block.p.a.asscala) { *insert actions here* }
Comments
Post a Comment