Reputation: 51601
How can I get a HashMap to a List? Something like:
Map<String, Horse> horses = new HashMap<String, Horse>();
ArrayList<Horse> = horses.toArray();
?
Thanks
Upvotes: 2
Views: 145
Reputation: 35331
List<Horses> = new ArrayList<Horses>(horses.values());
horses.values()
returns a Collection
, if that is also fine you can skip the creation of the ArrayList
.
Upvotes: 2