Apache Jakarta Commons Primitives 1.0 Released

(Back in 2003 I ran a moderately popular tech blog on the Radio UserLand platform. This is an archived version of a post from that blog. You can view an index of all the archived posts.)

Thursday, 6 November 2003

I've blogged a bit about the Primitives Component in the past, and I'm happy to note that commons-primitives now has an official 1.0 release (binaries) (source).

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.


This page was generated at 9:56 PM on 15 Jan 2016.
Copyright © 1999 - 2016 Rodney Waldhoff.