public function readMap(array $definition) {
        list($keyType, $valueType) = $definition;
        $map = [];
        $count = $this->readInt();
        for ($i = 0; $i < $count; ++$i) {
            $map[$this->readValue($keyType)] = $this->readValue($valueType);
        }
        return $map;
    }