This post originated from an RSS feed registered with Java Buzz
by Rod Waldhoff.
Original Post: Apache Jakarta Commons Primitives 1.0 Released
Feed Title: Rod Waldhoff: Java Channel
Feed URL: http://radio-weblogs.com/0122027/categories/java/rss.xml
Feed Description: about the Java programming language
Currently Primitives provides Java-primitive based versions of various Collection interfaces, which is substantially smaller and faster than working with the Object-wrapper equivalents. For instance, an ArrayShortList requires 1/10th the space of an ArrayList of Shorts, and an ArrayLongList requires 2/5ths the space of an ArrayList of Longs. There's a substantial time savings as well, in that one isn't constantly "boxing" and "unboxing" the primitives and their Object equivalents when moving them in and out of the Collection. There are readability and other advantages as well.
(And, no, as I understand it, neither the auto-boxing nor the generics features of JDK 1.5 will obviate the need for this library. You could use auto-boxing to emulate the syntax of list.add(int), but the internal representation will still be Object based.)
We use the primitive collections fairly extensively within the Axion database project for things like indices and lists of row identifiers or data file offsets, indeed the code was originally developed there.