コード例 #1
0
    private void add(Object key, long accesses) {
      if (accesses <= 0) {
        return;
      }

      KeyAccess access = keyAccessMap.get(key);

      if (access == null) {
        access = new KeyAccess(key, accesses);
        keyAccessMap.put(key, access);
      } else {
        access.accesses += accesses;
      }
    }
コード例 #2
0
    private void add(Object key, long accesses) {
      if (accesses <= 0) {
        return;
      }

      Integer index = keyAccessIndexMap.get(key);

      if (index == null) {
        KeyAccess keyAccess = new KeyAccess(key, accesses);
        add(keyAccess);
      } else {
        KeyAccess keyAccess = sortedKeyAccess.get(index);
        keyAccess.accesses += accesses;
        update(index);
      }
    }