2
Contributors
5
Replies
6
Views
5 Years
Discussion Span
Last Post by javausers
0

So, you want to do something like:

Map<String, Object[]> objectMap = new TreeMap<String, Object[]>();
Object[] values = new String[] {"A", "B", "C"};
objectMap.put("First3Letters", values);

Is that right? Yes, you can do that.

0

Exactly, but, I have read that: "each key can map to at most one value"

1

That means that each key can map to one entry in the map. The map doesn't care what's in the entry (or "value" as it is called). All it knows is that there is an object there (an array is considered an object).

Does that make sense?

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.