If you just want two keys to point to the same value, that is perfectly fine. Maps don't care what they point to, just that there aren't conflicting keys.
If you want to add the integer values together, then your pseudocode works as you intend.
If you want pointer like behavior where changing the value of key A affects the value of key B, then you'd have to make a wrapper object and use fields.
Something like:
class Pointer<T> {
private T t;
public Pointer(T t) {
set(t);
}
public void set(T t) {
this.t = t;
}
public T get() {
return t;
}
}
...
Map<String, Pointer> map = new HashMap<>();
Pointer<Integer> ptr = new Pointer<>(5);
map.put("A", ptr);
map.put("B", ptr);
System.out.println(map.get("A").get());
System.out.println(map.get("B").get());
ptr.set(25);
System.out.println(map.get("A").get());
System.out.println(map.get("B").get());
If you want something else you may need to elaborate or consider another data structure.