Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there a Java equivalent of KeyValuePair<T, T> (i.e. a single hashmap 'cell') type?

I used to find these very useful in .NET and I'm unsure of any equivalent.

like image 205
Alex Avatar asked Jan 07 '11 23:01

Alex


People also ask

How can I return a single key value pair in Java?

Implement Key Value Pair Using Properties Class in Java The Properties class of Java collections can be used to store data into key-value pairs. The getProperty() method of the Properties class returns the value associated with the key.

Which is used to manage the data in key value pair in Java?

HashMap is a part of Java's collection since Java 1.2. It provides the basic implementation of the Map interface of Java. It stores the data in (Key, Value) pairs, and in order to access a value, one must know its key.


1 Answers

There's Map.Entry<K, V>, which represents map entries. I'm not a C# programmer, but this seems like the most similar thing to what you want.

like image 88
templatetypedef Avatar answered Oct 15 '22 20:10

templatetypedef