code: public double getCount(A first, B second) {
      if (counts.containsKey(first) && counts.get(first).containsKey(second)) {
        return counts.get(first).get(second);
      }
      return 0.0;
    }
docs: Gets the number of times (first, second) has occurred.