CQM CQM - 5 months ago 17
Java Question

java key/value pair object, that isn't an array/map

I want a key value pair object. Just two strings

so

Object<String, String>


is there an existing object in java to facilitate this before I reinvent the wheel?

The only reason I didn't immediately gravitate to Hash/Map this time is because that one object is made to store multiple key/value pairs. Is there one designed to hold just a single key/value pair, that I can turn into an array if I feel inclined to do so?

Answer

You will need to create your own. This is done (AFAIK) to facilitate a better semantic meaning from the class name, than a general Pair<> or KeyValuePair<> would

Comments