Yeah I use a one-int array, or AtomicInteger, for situations like this. If the overhead of all those tiny objects gets excessive, in a really critical bit of code, we can look into alternate implementations that use different internal representation.
---------- Forwarded message ---------- From: Ted Dunning <[EMAIL PROTECTED]> Date: Fri, Aug 22, 2008 at 6:23 PM Subject: Re: Java style notes To: [email protected] Another example of this sort of issue is where we have a table of counters. The temptation is to have a Map<String, Integer> or some such. Much better is Map<String, MutableInteger> where we define the MutableInteger to have an increment. Even better than that may be to use a primitive hash table such as provided by trove. In a recent piece of code, I saw this sort of change make nearly 10x difference in speed.
