Why do Eclipse APIs use arrays instead of collections?

In the Eclipse APIs, return and argument types are basically arrays instead of collections. An example is the method memberson IContainer, which returns IResources[].

I am wondering why this is so. Perhaps this is one of the following:

  • APIs were developed before generic generators were available, so it IResource[]was better than just CollectionorList
  • Memory concerns, for example. ArrayListinternally contains an array that has more space than necessary (to ensure efficient implementation add), while the array is always built only for the required target size
  • It is not possible to add / remove elements in the array, therefore it is safe to iterate (but protective copying is still necessary because elements can still be changed, for example, set them to null)

Does anyone have any ideas or other ideas why the API was designed this way?

+5
source share
1 answer

Conducting this as an answer, so it can be accepted.

Eclipse , API. , SWT , -, API- , . , , . , .

, , api, , .

+1

All Articles