Instead of creating multiple instances of List0, Set0, and Map0, they should be singletons. This would save space in the cases where a lot of them are used. On the other hand, there may be a code size advantage sharing a single field-based implementation for small collections, say with 0, 1, or 2 elements. Sharing a singleton seems to make sense, but sometimes creating apparently redundant copies improves locality. The tradeoff isn't obvious.
|