Alex Rivera | Logout

How to store more than one string in a Map?

Asked 2010-09-16T10:20:24.073
24

Is it possible to set more than two pair value?

For example:

Map<String,String,String,String>

number,name,address,phone - All come together for display the values. Each value associated with others.

Edit
Report

2 Answers

137

You're in object denial. You should use an object that holds the number, name, address, phone (maybe you could call it ContactInformation) and put that into the map.

answered 2010-09-16T10:23:46.440
1

Your question suggests you want key on each of the 4 fields and all others become values. While in general, it is one key and multiple values packed on a object.

Please confirm what is required.

answered 2010-09-16T11:06:48.397

Your Answer