Because of the implementation of containers, the contained type cannot be instantiated within them. An inconvenient consequence is toArray. There are two ways to call it
1.
Object arr[] = list.toArray();
But it's not easy to change Object[] to Type[].
2.
Type arr[] = new Type[m];
list.toArray(arr);
But it would be much better not to have to allocate arr separately.
The next version of Java should really reconsider the implementation of templates.
Friday, September 26, 2008
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment