I tried using Guava's immutable collections, specifically ImmutableList as return type in mapper functions, but obviously MyBatis does not know how to construct them. Unfortunately, it looks like currently there is no way make it work (see my question on stackoverflow for more details).

It would be really nice to have a mechanism to allow mapping results to custom collections or custom implementations of JDK's collection interfaces.

Comment From: XenoAmess

seems you can just add a SPI mechenism here. MyBatis A mechanism to allow returning custom collections and/or implementations from mapper functions