If you really want to precalculate this in the way you have described, you can use a HashMap for this. Use the neighbouring object as key and the distance as value. Make sure you implement the hashCode() and equals()-methods in your objects to allow for using them as keys in a HashMap.
But like Herko_ter_Horst pointet out, this may not be the best solution to your problem. Since it is very easy and cheap to calculate the distance between two points, just give your objects a location property, so your “object1.distance(object2)” method just calculates the distance on the fly by substracting the two locations.
The real problem is to find the two objects you need to calculate the exact distance for. In the first place you have to reduce the amount of objects to test, like grouping them in neighbouring clusters. If this is what you are after, Google for “space partitioning trees” like BSP trees, quadtrees and octrees.