I used to find these very useful in .NET and I'm unsure of any equivalen开发者_Python百科t.
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.
Not sure if this is what you're looking for but there's a singleton hashmap:
Map<K, V> map = Collections.singletonMap(key, value);
Maybe you can describe what you would like to do with it?
精彩评论