public long getId(Object key) {
      long newId = nextId.incrementAndGet();
      Long existingId = idMap.putIfAbsent(key, newId);
      if (existingId != null) {
        return existingId;
      }

      return newId;
    }
public long getId(Object key)