I'm new to Android and while going through a tutorial on saving Activity
state to a Bundle, I noticed that instead of accepting the more generic List
interface, Bundle
's put methods are expecting ArrayLists
.
Example:
Bundle.putCharSequenceArrayList(key, value)
Bundle.putIntegerArrayList(key, value)
Bundle.putParcelableArrayList(key, value)
Bundle.putStringArrayList(key, value)
Most of us are familiar with item 52 of Effective Java suggesting that objects must be refered to by their interface, so I am wondering what was the reason behind this API decision.
Is ArrayList
perhaps the preferred list implementation in Android?