When using an android bundle, why does a serialised stack deserialise as an ArrayList?

后端 未结 3 962
醉酒成梦
醉酒成梦 2020-12-31 12:02

Serialisation:

Bundle activityArguments = new Bundle();
Stack> wizardSteps = new Stack

        
3条回答
  •  一生所求
    2020-12-31 12:46

    I hope am not talking any nonsense!

    Stack does not implement Serializable but rather just extends the Serializable Vector which is equivalent to ArrayList

    I am unaware of the real definition of equivalent and how loose could that be, but it is sufficient to say that the first super class of Stack that is Serializable is Vector.

    Since we see this exception, then I would probably assume that casting the Serializable to ArrayList should not throw this exception. Otherwise, I am talking nonsense.

提交回复
热议问题