Why does ArrayList use transient storage?

前端 未结 6 1274
既然无缘
既然无缘 2020-12-24 05:55

I was reading the source of Java\'s ArrayList and I came across its backing array declaration:

private transient Object[] elementData;

Why

6条回答
  •  一向
    一向 (楼主)
    2020-12-24 06:33

    Because it implements explicit serialization. See ArrayList#writeObject.

提交回复
热议问题