Manning's Countdown to 2014
. Use discount code crdotd14 all month for 50% off every deal.
A friendly place for programming greenhorns!
Big Moose Saloon
Register / Login
Java in General
create a list of key/value pairs
Joined: Sep 27, 2004
Aug 12, 2011 20:59:57
I am not sure if the following is doable:
I have say a hashmap - key:"1" value: "one".
I want to convert this hashmap to a list - ["1":"one"]
Is this doable?
SCJP 1.4, SCWCD 1.4<br /> <br />Thanks in advance!<br />Jayashree.
Joined: Mar 09, 2010
Aug 12, 2011 21:53:39
Yes. You can iterate over the map and insert them into the list.
Author and ninkuma
Joined: Jan 10, 2002
Aug 12, 2011 22:29:09
method of the Map interface should be of help.
Asking smart questions
Books by Bear
Joined: Oct 13, 2005
Aug 13, 2011 02:41:55
Do you really want a List? There is no particular order to the entries in a Map. You can use a hybrid
list and Map
of you wish to introduce an ordering.
Did you see how Paul
cut 87% off of his electric heat bill with 82 watts of micro heaters
subject: create a list of key/value pairs
Records in Arraylist
Convert List to a Map
Sorting Keys(Value Objects) in HashMap
I want to check previous (value) of HashMap before adding the current key?
All times are in JavaRanch time: GMT-6 in summer, GMT-7 in winter
| Powered by
Copyright © 1998-2013