My bad.
I've only just installed Java 1.5 on my Mac and haven't really used
collections with primitives yet.
did i miss something? i'm pretty sure java 1.5 STILL (ahem, apple...) has
not been released for macos 10.
Turns out generics in Java is
sufficiently different from generics in C++. List<int> doesn't work in
Java....
correct. generics in Java works only with reference objects. although,
you can certainly create a list such as:
List<Integer> myList = new ArrayList<Integer>();
and then add ints via autoboxing:
myList.add(5);
although, be sure to read about autoboxing/unboxing as for
high-performance applications this is not a good way of introducing
collections and primitives. if your app is of that nature
(high-performance), it is still better to use your own simple (and often
array-based) data structures. the Collection Framework is good to work
with at times, but can cause your app to be unbearably slow at times
(especially when considering the extra call stack items that are run when
doing auto boxing/unboxing).