File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Beginning Java and the fly likes 2-dim array or vectors solution Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of REST with Spring (video course) this week in the Spring forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "2-dim array or vectors solution" Watch "2-dim array or vectors solution" New topic

2-dim array or vectors solution

Gary Frick

Joined: Sep 13, 2002
Posts: 28
I need to store and run a tab on a list of items. The purpose is to do a running tally of a given item as the items present themselves. For example, If I were do a query selecting all fruit. I then need to tally up how many kinds of fruit were returned. So the 1st value is the type of fruit, and the second is a running count that gets incremented. Which mechanisam (arrays or vectors) are better suited for this? And how do I implement so that I have one entry of each type of fruit and then can update the second dimension that is the running count?
Most appreciative,
Dave Landers
Ranch Hand

Joined: Jul 24, 2002
Posts: 401
Sounds like a job for Map
Gary Frick

Joined: Sep 13, 2002
Posts: 28
Java Ranch is the best. Dave, you taught me something new. MAP is just what I need. Thanks
Consider Paul's rocket mass heater.
subject: 2-dim array or vectors solution
It's not a secret anymore!