> I Need To Separate Book Names From Prices In A Text Document And Store It In A HashMap?

I Need To Separate Book Names From Prices In A Text Document And Store It In A HashMap?

Posted at: 2014-12-18 
Map m = new HashMap();



m.put(price, title);

But are you sure you want to use price as the key? What if Europe on a Shoestring turns out to be really popular, so they raise the price to 11.95? Now I Did It Your Way won't exist in the map anymore, it will just get thrown away.

Using the title as the key would make more sense, unless duplicate prices really are not allowed.

I want to learn calculus in one day.

I have a GUI program that reads from a text document of books and prices delimited by a ;

I Did It Your Way;11.95

The History of Scotland;14.50

Learn Calculus in One Day;29.95

Feel the Stress;18.50

Great Poems;12.95

Europe on a Shoestring;10.95

The Life of Mozart;14.50

I want to store these in a map so that the key is the price and the name is the HashMap item.

How Do I Do That?