ImmutableCollection for GWT-RPC serialization

I understand that the DTOs that will be serialized for the GWT RPC must declare their fields with the smallest possible implementation for performance reasons. For example, you should stick ArrayListto Listor Collectioncontrary to the recommendations that we usually get nasty (e.g. Effective Java, Item 52).

With JDK collections, this is not a problem, most of the time, Mapis HashMap, a Setis HashSet, but List- ArrayList. However, I use the Guava Immutable * collections (like ImmutableList ), where I really don't know which implementation I will get. Do I just need to suck it and let the GWT emulate all of them, or is there a way to do damage control here?

+3
source share
1 answer

Right Just use the most specific type that is part of the API.

, @GwtCompatible(serializable = true), GWT RPC, ( @GwtCompatible(serializable = false)). Immutable* GWT RPC.

+4

All Articles