HashMap with primitive int key



Dear All,

I have a class like this:

class CustomerOrder {
int globalID;
...
}

I have an array of these.
I'd like to store an index of globalIDs, so I can do:

CustomerOrder o = index.get(123)

I could modify my class to be:

class CustomerOrder {
Integer globalID;
...
}

Perhaps it is my C++ background, but the idea of allocating an object for every
ID when I can just use an int bothers me.

I figure a HashMap is the right tool of choice, e.g.:

HashMap<Integer, CustomerOrder> index = new ...


Has anyone out there already written a modified hashmap class that uses int as
the key?

Thanks for any tips :)

Andrew
.