code: public void claimName(String name) {
      checkName(name);
      if (names.add(name, 1) != 0) {
        names.remove(name);
        // give a slightly better error message in this case
        if (reserved.contains(name)) {
          throw new IllegalArgumentException("Tried to claim a reserved name: " + name);
        }
        throw new IllegalArgumentException("Name: " + name + " was already claimed!");
      }
    }
docs: Registers the name, throwing an IllegalArgumentException if it has already been registered.