class LookupShardManager extends ShardManager {

  private final Map<Integer, Integer> lookupMap = new HashMap<>();

  @Override
  public int storeData(Data data) {
    var shardId = allocateShard(data);
    lookupMap.put(data.getKey(), shardId);
    var shard = shardMap.get(shardId);
    shard.storeData(data);
    LOGGER.info(data.toString() + " is stored in Shard " + shardId);
    return shardId;
  }

  @Override
  protected int allocateShard(Data data) {<FILL_FUNCTION_BODY>}

}

    var key = data.getKey();
    if (lookupMap.containsKey(key)) {
      return lookupMap.get(key);
    } else {
      var shardCount = shardMap.size();
      return new SecureRandom().nextInt(shardCount - 1) + 1;
    }
  
<methods>public void <init>() ,public boolean addNewShard(com.iluwatar.sharding.Shard) ,public com.iluwatar.sharding.Shard getShardById(int) ,public boolean removeShardById(int) ,public abstract int storeData(com.iluwatar.sharding.Data) <variables>protected Map<java.lang.Integer,com.iluwatar.sharding.Shard> shardMap