How to represent indexed or parametrized attributes in UML?
For example, how to reverse the following Java code:
class MyClass {
Object getValue(String key);
void setValue(String key, Object value);
}
From the one hand I can describe it simple

but this will not show that these 2 methods are related.
From the other hand I can describe it

but this will hide the fact, that multiple instances of a value are named by key parameter.
The similar problem arise with the following C# code:
class MyClass
{
public string this[int i]
{
get
{
}
set
{
}
}
}
There isn’t a great answer for this since this class is in effect a dictionary/hash. A discussion of options you can choose be found here:
How to represent a .NET dictionary type in UML?
or possibly this (as referenced):
How to describe a contained map in UML class diagram?