'transient' is a property of the variable; not of the object that the variable refers to. As Burkhard says, you don't add a variable to a collection. You can add the value of a variable to a collection. The object that the variable refers to, doesn't know that the variable is transient.
All collection classes implement Serializable, so you can e.g. serialize an ArrayList. If you want the contents stored inside back, also this objects need to be serializable.
The main reason why a variable is marked transient is that the object it holds is not serializable. You won't be able to serialize the collection if an object that's inside is not serializable. You would get a otSerializableException.
If it is transient, you will get your collection back, and where the transient variables were you'll get null:
output is: before: [Cat with 9 lives, Cat with 7 lives, StrangeCat with 9 lives and with a Mouse: Mouse@130c19b] after deserialization: [Cat with 9 lives, Cat with 7 lives, StrangeCat with 9 lives and with a Mouse: null]
StrangeCat also implements Serializable (by inheritance).
all events occur in real time
Have you no shame? Have you no decency? Have you no tiny ad?