Skip to Main Content

Java Programming

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Ordering a Hashmap

807606Apr 2 2007 — edited Apr 2 2007
Hello,

HashMap<String, String>trendRangeMap = new HashMap<String, String>();
trendRangeMap.put("1", "Curr. Mo.");
trendRangeMap.put("3", "3 Mo.");
trendRangeMap.put("6", "6 Mo.");
trendRangeMap.put("12", "12 Mo.");
I put the previous code into a HashMap. I want to the order of the data that I put into the HashMap to come out in the same order. I need to input this data into a website. Where the HashMap key is equal to the value in the input tag and the HashMap value is equal to the value that is actually displayed as a label by the radio button. I know lists can be ordered, but my problem is that I need both values, HashMap key and value. I want the output to be ordered by key.
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Apr 30 2007
Added on Apr 2 2007
6 comments
137 views