+3  A: 

I'd approach this problem like this by just creating a set of positions. A set models a collection of objects that can only occur once. In comparison a map structure stores a set of key / value associations. From my reading of your question, I think a set structure makes most sense.

// You might just be able to use an existing Point depending on what you
// want to do with the position
class Position {
  int x;
  int y;

  // implementations of hashCode() + equals()
  }
}

You need to implement hashCode() so that items can be distributed uniformly in the set and equals() so that objects can be compared. See here for more information.

Set<Position> positions = new HashSet<Position>();
positions.add(new Position(3,4));
positions.add(new Position(5,6)); // and so on

Make sure you define equals / hashCode appropriately (there's plenty of links for this)

You can now test whether a point is in the set using the contains method such as:

positions.contains(new Point(2,1)); // returns false
positions.contains(new Point(3,4)); // returns true
Jeff Foster
A: 

I would suggest using google-collection's MultiMap. This is effectively a managed type for Map<K, Collection<V>>.

Also of interest may be the Multimaps class, which gives you Multimap<K,V> invertFrom(Multimap<V,K>)

Then you could end up with:

public boolean isPositionOccupied(int x, int y) {
    return occupiedPositionsMap.get(x).contains(y);
}

See? Wow! no need for null checks or other nonsense.

Note: This is relatively optimal from a performance point of view, but depending on your other needs, you may want to use Point objects as noted in other answers.

Stephen
FWIW, that can also be expressed as occupiedPositionsMap.containsEntry(x, y) in case you find that clearer.
Kevin Bourrillion