class ShardManager {

  protected Map<Integer, Shard> shardMap;

  public ShardManager() {
    shardMap = new HashMap<>();
  }

  /**
   * Add a provided shard instance to shardMap.
   *
   * @param shard new shard instance.
   * @return {@code true} if succeed to add the new instance.
   *         {@code false} if the shardId is already existed.
   */
  public boolean addNewShard(final Shard shard) {
    var shardId = shard.getId();
    if (!shardMap.containsKey(shardId)) {
      shardMap.put(shardId, shard);
      return true;
    } else {
      return false;
    }
  }

  /**
   * Remove a shard instance by provided Id.
   *
   * @param shardId Id of shard instance to remove.
   * @return {@code true} if removed. {@code false} if the shardId is not existed.
   */
  public boolean removeShardById(final int shardId) {<FILL_FUNCTION_BODY>}

  /**
   * Get shard instance by provided shardId.
   *
   * @param shardId id of shard instance to get
   * @return required shard instance
   */
  public Shard getShardById(final int shardId) {
    return shardMap.get(shardId);
  }

  /**
   * Store data in proper shard instance.
   *
   * @param data new data
   * @return id of shard that the data is stored in
   */
  public abstract int storeData(final Data data);

  /**
   * Allocate proper shard to provided data.
   *
   * @param data new data
   * @return id of shard that the data should be stored
   */
  protected abstract int allocateShard(final Data data);

}

    if (shardMap.containsKey(shardId)) {
      shardMap.remove(shardId);
      return true;
    } else {
      return false;
    }
  
<no_super_class>