This week's book giveaway is in the JDBC forum.
We're giving away four copies of Make it so: Java DB Connections & Transactions and have Marcho Behler on-line!
See this thread for details.
The moose likes Java in General and the fly likes Array to Hashmap Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Make it so: Java DB Connections & Transactions this week in the JDBC forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "Array to Hashmap " Watch "Array to Hashmap " New topic

Array to Hashmap

Seetesh Hindlekar
Ranch Hand

Joined: Feb 13, 2004
Posts: 244
Hi all,
How do i create a Hashmap from an Array?
William Brogden
Author and all-around good cowpoke

Joined: Mar 22, 2000
Posts: 13028
Since each entry in a HashMap requires a key and a value, there is no single call to create a HashMap from an array. Starting with a newly constructed HashMap, you have to put( key, value ) for each value in the array.
I agree. Here's the link:
subject: Array to Hashmap
It's not a secret anymore!