Incrementing a TreeMap value
From: Kevin (kevkf_at_charter.net)
Date: 01/29/04
- Next message: Cowboy Bob: "Conditional Bean:Define Statements In Struts"
- Previous message: Terry Xie: "How to capture Ctrl-c in Java(console or event)"
- Next in thread: Ryan Stewart: "Re: Incrementing a TreeMap value"
- Reply: Ryan Stewart: "Re: Incrementing a TreeMap value"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
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
- Next message: Cowboy Bob: "Conditional Bean:Define Statements In Struts"
- Previous message: Terry Xie: "How to capture Ctrl-c in Java(console or event)"
- Next in thread: Ryan Stewart: "Re: Incrementing a TreeMap value"
- Reply: Ryan Stewart: "Re: Incrementing a TreeMap value"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]