RemoteCallbackList 与 arrayList

RemoteCallbackList vs arrayList

When we use aidl ,we often use  code like this:

RemoteCallbackList<IRemoteServiceCallback> mCallbacks.

我们可以使用 ArrayList<IRemoteServiceCallback> mCallbacks 吗?

它是一个 ListArrayList 相同,所以 YES 但你不想这样做,因为 RemoteCallbackList 为你来命名 1

Keeps track of a set of registered IInterface callbacks

还有

If a registered callback's process goes away, this class will take care of automatically removing it from the list. If you want to do additional work in this situation, you can create a subclass that implements the onCallbackDied(E) method.

文档中的所有引用