code: private Collection<Tile> getSharedNeigbors(Tile tile1, Tile tile2)
      {
          final Collection<Tile> neighbors1 = map.getNeighbors(tile1);
          final Collection<Tile> neighbors2 = map.getNeighbors(tile2);
          final Collection<Tile> sharedNeighbors = new HashSet<>(2);
          for (final Tile neighbor : neighbors1)
          {
              if (neighbors2.contains(neighbor))
              {
                  sharedNeighbors.add(neighbor);
              }
          }
          neighbors1.clear();
          neighbors2.clear();
          return sharedNeighbors;
      }
docs: Get the neighbors in commons between two tiles.
  
  @param tile1 The first tile.
  @param tile2 The second tile.
  @return The neighbors in common (should be 2).