Incrementing a TreeMap value

From: Kevin (kevkf_at_charter.net)
Date: 01/29/04


Date: Wed, 28 Jan 2004 17:58:42 -0600

I am writing code to parse text. Each word gets put into a TreeMap as
the key value, and an Integer counting the number of occurrances of
the word. I can put the key-value pairs into the TreeMap and retrieve
them.

What I don't know how to do is increment the Integer which is stored
in the value part of the TreeMap. Do I need to retrieve the entry
first, add one to the Integer, remove the map entry, and put a new
entry?

Thanks for any help!

Kevin