Since all java LinkedList member variables are transient, what will the use of Serializable be?

1). In the LinkedList implementation, all 3-element size variables, firstly, the latter are temporary, then what is the point of serialization implementation?

2) What will be saved when trying to serialize LinkedList?

+3
source share
2 answers

You will notice that it LinkedListhas methods writeObjectand readObject. They write / read the size of the list and write / read each object in the list.

Note that these methods (but also the fields) are private, so the implementation may change. Do not depend on it. Depends on the interfaces.

+5
source

readObject() writeObject(). , , .

+3

Source: https://habr.com/ru/post/1615380/


All Articles