I want to return map value by using position which is the key of the map I have this function :
Map<Pair<Integer , Integer> , Unit> map = new HashMap<>();
public Unit getUnit(Pair<Integer , Integer> position){
return map;
}
You'd get the value like you would with any other key, using Map.get
:
public Unit getUnit(Pair<Integer, Integer> position) {
return map.get(position);
}