I am looking at this API ArrayListMultiMap
which implements the Serializable
interface. Does that mean I can serialize this object ? Are all Multimap objects serialized ?
The meaning of Serializable
is always the same: If an object isn't serializable, it can't be serialized. If it is, it may work or not... Especially in case of collections (including maps and multimaps), it depends on their content.
As an example, you can surely serialize ArrayList<String>
as ArrayList.class
is serializable and so is each member of the list. OTOH trying to serialize ArrayList<Object>
may or may not work: If all contained objects are e.g. strings, it will work. If any member is not serializable, you'll get an exception.
Does it mean I can serialize this object?
If all keys and values are serializable, you can.
Are all multiMap object serializable?
No, the interface Multimap
doesn't extend Serializable
, so there may be non-serializable implementation. Indeed, you can get such an instance via e.g. Multimaps.filterEntries
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With