/**
   * @param infos Entry infos.
   * @return Result map.
   */
  private Map<K, V> createResultMap(Collection<GridCacheEntryInfo> infos) {
    int keysSize = infos.size();

    if (keysSize != 0) {
      Map<K, V> map = new GridLeanMap<>(keysSize);

      for (GridCacheEntryInfo info : infos) {
        assert skipVals == (info.value() == null);

        cctx.addResult(
            map,
            info.key(),
            info.value(),
            skipVals,
            keepCacheObjects,
            deserializeBinary,
            false,
            needVer ? info.version() : null);
      }

      return map;
    }

    return Collections.emptyMap();
  }
  /**
   * @param p Partition.
   * @param info Entry to add.
   * @param ctx Cache context.
   * @throws IgniteCheckedException If failed.
   */
  void addEntry0(int p, GridCacheEntryInfo info, GridCacheContext ctx)
      throws IgniteCheckedException {
    assert info != null;
    assert (info.key() != null || info.keyBytes() != null);
    assert info.value() != null;

    // Need to call this method to initialize info properly.
    marshalInfo(info, ctx);

    msgSize += info.marshalledSize(ctx);

    CacheEntryInfoCollection infoCol = infos.get(p);

    if (infoCol == null) {
      msgSize += 4;

      infos.put(p, infoCol = new CacheEntryInfoCollection());

      infoCol.init();
    }

    infoCol.add(info);
  }
  /**
   * @param p Partition.
   * @param info Entry to add.
   * @param ctx Cache context.
   * @throws IgniteCheckedException If failed.
   */
  void addEntry(int p, GridCacheEntryInfo info, GridCacheContext ctx)
      throws IgniteCheckedException {
    assert info != null;

    marshalInfo(info, ctx);

    msgSize += info.marshalledSize(ctx);

    CacheEntryInfoCollection infoCol = infos.get(p);

    if (infoCol == null) {
      msgSize += 4;

      infos.put(p, infoCol = new CacheEntryInfoCollection());

      infoCol.init();
    }

    infoCol.add(info);
  }