문제

I am using the version 17.0 of Guava, especially the new collection types. While trying to write an ImmutableTable through a Socket, I realized that the class and its concrete implementations do not seem to be serializable.

However, the two following tickets seem to indicate that the developers are aware of the issue:

Do any of you serialize classes containing ImmutableTable attributes? How could I do this, without resorting to using a Map of Maps?

도움이 되었습니까?

해결책

Even though ImmuttableTable isn't serializable, you could always use a HashBasedTable or one of the other Table implementations. And then after deserialization, use ImmutableTable.copyOf(deserialized) to get the ImmutableTable again. Not exactly elegant, but simple enough to implement.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top