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

I used them very useful in .NET, and I'm not sure about the equivalent.

+4
source share
2 answers

Here is Map.Entry<K, V> , which represents map entries. I am not a C # programmer, but it seems like the most similar to what you want.

+13
source

Not sure if this is what you are looking for, but there is a hashmap singleton:

 Map<K, V> map = Collections.singletonMap(key, value); 

Maybe you can describe what you would like to do with it?

+1
source

Source: https://habr.com/ru/post/1334721/


All Articles