Hi,
I want to Map a single key to array of values. Is that possible?
javausers
0
Newbie Poster
Recommended Answers
Jump to PostSo, 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.
Jump to PostThat 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?
All 5 Replies
javausers
0
Newbie Poster
dononelson
2
Junior Poster in Training
javausers
0
Newbie Poster
dononelson
2
Junior Poster in Training
javausers
0
Newbie Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.