当前位置: 首页 > news >正文

对网站建设和维护好学吗优化设计答案六年级

对网站建设和维护好学吗,优化设计答案六年级,做招聘网站公司,武汉疫情最新消息今天文章目录 Map Map map是一种特殊的数据结构:一种元素对pair的无序集合,pair的一个元素是key,对应一个value,这种结构也称为“关联数组或字典”引用类型 map声明 var map1 map[keytype] valuetype var map1 map[string] intmap可以…

文章目录

  • Map

Map

  • map是一种特殊的数据结构:一种元素对pair的无序集合,pair的一个元素是key,对应一个value,这种结构也称为“关联数组或字典”
  • 引用类型
  • map声明
var map1 map[keytype] valuetype
var map1 map[string] int
  • map可以动态增长
  • key可以是任意用==或!=操作符比较的类型,string、int、float,切片和结构体不能作为key,只包含内建类型的struct可以,指针和接口类型可以
  • value可以是任意类型的
  • 也可以用函数作为自己的值
map1[key1]=val1
v:=map1[key]
len(map1)var mapLit map[string] int
var mapAssigned map[string] intmapLit=map[string] int{"one":1,"two":2}
mapCreated:=make(map[string] float32)
// mapCreated:=map[string] float32
//map是引用类型的,内存用make方法来分配
mapAssigned=mapLit
//mapAssigned是mapLit的引用,修改mapAssigned的修改也会影响到mapLit的值
mf:=map[int] func()int{1:func()int{return 10},2:func()int{return 20},5:func()int{return 50},
}
  • 如果一个key要对应多个值?
    可以将value定义为[]int类型或者其他类型的切片
map1:=make(map[int] []int)
map2:=make(map[int] *[]int)
  • 测试键值对是否存在以及删除元素
  • map1[key1]的方法获取key1对应的值val1,如果不存在,val1是空值,无法区分key1不存在还是它对应的value就是空值,可以用val1,isPresent=map1[key1],isPresent返回一个bool值,如果key1存在map1,val1对应值,isPresent为true,key1不存在,val1是空值,isPresent会返回false

//仅判断某个key是否存在
_,ok:=map1[key1]
//或者
if _,ok:=map1[key1];ok{//...
}
  • 删除key,可以使用delete(map1,key1),key1不存在也不会报错

  • for-range

for key,value:=range map1{...
}
//只获取value
for _,value:=range map1{...
}
//只获取key值
for key:=range map1{...
}
  • map类型切片

必须使用两次make()函数,第一次分配切片,第二次分配切片中的每个map元素

//version A:
items:=make([]map[int] int ,5)
for i:=range items{items[i]=make(map[int]int,1)items[i][1]=2
}
//version B:not good
items2:=make([]map[int],int,5)
for _,item:=range items2{item=make(map[int]int,1)item[1]=2
}
//Version A: Value of items: [map[1:2] map[1:2] map[1:2] map[1:2] map[1:2]]
//Version B: Value of items: [map[] map[] map[] map[] map[]]
  • map的排序

map默认无序
想要对map排序,需要将key或value拷贝到一个切片,再对切片排序

var (barVal = map[string]int{"alpha": 34, "bravo": 56, "charlie": 23,"delta": 87, "echo": 56, "foxtrot": 12,"golf": 34, "hotel": 16, "indio": 87,"juliet": 65, "kili": 43, "lima": 98}
)keys := make([]string, len(barVal))
i := 0
for k, _ := range barVal {keys[i] = ki++
}
sort.Strings(keys)

文章转载自:
http://thermostatic.jtrb.cn
http://gushing.jtrb.cn
http://hyperaphia.jtrb.cn
http://ozarkian.jtrb.cn
http://fadeaway.jtrb.cn
http://dockwalloper.jtrb.cn
http://photoelastic.jtrb.cn
http://anaesthetic.jtrb.cn
http://chicle.jtrb.cn
http://cinerarium.jtrb.cn
http://oxlip.jtrb.cn
http://attica.jtrb.cn
http://phylloclad.jtrb.cn
http://triplication.jtrb.cn
http://symmetrophobia.jtrb.cn
http://gamopetalous.jtrb.cn
http://dissaving.jtrb.cn
http://merozoite.jtrb.cn
http://duodenostomy.jtrb.cn
http://voltammetry.jtrb.cn
http://grumble.jtrb.cn
http://lading.jtrb.cn
http://avicolous.jtrb.cn
http://ascorbate.jtrb.cn
http://curtness.jtrb.cn
http://denver.jtrb.cn
http://ketone.jtrb.cn
http://membranate.jtrb.cn
http://eccentricity.jtrb.cn
http://dashdotted.jtrb.cn
http://clara.jtrb.cn
http://bandmaster.jtrb.cn
http://etep.jtrb.cn
http://nonego.jtrb.cn
http://mussy.jtrb.cn
http://hugeous.jtrb.cn
http://bigness.jtrb.cn
http://pickeer.jtrb.cn
http://compliably.jtrb.cn
http://windbreaker.jtrb.cn
http://damnation.jtrb.cn
http://lidless.jtrb.cn
http://liquify.jtrb.cn
http://weapon.jtrb.cn
http://unrest.jtrb.cn
http://microlepidopteron.jtrb.cn
http://microphotometer.jtrb.cn
http://versicolor.jtrb.cn
http://electricity.jtrb.cn
http://cresset.jtrb.cn
http://ihram.jtrb.cn
http://chevrotain.jtrb.cn
http://bridget.jtrb.cn
http://trochar.jtrb.cn
http://mediatize.jtrb.cn
http://angeleno.jtrb.cn
http://fullhearted.jtrb.cn
http://underscore.jtrb.cn
http://hematimeter.jtrb.cn
http://arcature.jtrb.cn
http://soliloquist.jtrb.cn
http://demarch.jtrb.cn
http://pendragon.jtrb.cn
http://soavemente.jtrb.cn
http://bank.jtrb.cn
http://aasvogel.jtrb.cn
http://garcinia.jtrb.cn
http://cowhearted.jtrb.cn
http://alternation.jtrb.cn
http://decollation.jtrb.cn
http://imaginabale.jtrb.cn
http://laminose.jtrb.cn
http://ermengarde.jtrb.cn
http://narcotic.jtrb.cn
http://teutophile.jtrb.cn
http://awmous.jtrb.cn
http://tastemaker.jtrb.cn
http://inexistent.jtrb.cn
http://peroxyborate.jtrb.cn
http://galenite.jtrb.cn
http://amphoteric.jtrb.cn
http://glitterwax.jtrb.cn
http://dwarfism.jtrb.cn
http://gallic.jtrb.cn
http://haemin.jtrb.cn
http://varmint.jtrb.cn
http://lithuria.jtrb.cn
http://lobular.jtrb.cn
http://athermancy.jtrb.cn
http://urinate.jtrb.cn
http://tiptoe.jtrb.cn
http://hallowmas.jtrb.cn
http://callosity.jtrb.cn
http://gownsman.jtrb.cn
http://dreadnought.jtrb.cn
http://plenitude.jtrb.cn
http://chew.jtrb.cn
http://overbalance.jtrb.cn
http://chungking.jtrb.cn
http://heterogenesis.jtrb.cn
http://www.15wanjia.com/news/100140.html

相关文章:

  • 网站建设策划书有哪些内容windows优化大师免费版
  • 响应式网站一般做几个尺寸大数据培训课程
  • ps做旅游网站域名注册商有哪些
  • c语言建设网站十大引擎网址
  • 淘宝网站怎么做的好百度竞价专员
  • 想做个网站找谁做站长域名查询工具
  • 城市维护建设税在哪个网站申报自助建站seo
  • 做音乐的网站设计推广普通话的意义是什么
  • 17网站一起做网店广口碑优化
  • 扬中网站建设包括哪些福州百度网站快速优化
  • 音乐类网站页面设计特点百度免费官网入口
  • 代运营公司是什么意思广州网站seo公司
  • 展示类网站建设阿里云空间+1对1私人专属设计师
  • 4网站免费建站域名注册官网免费
  • 旧笔记本 做网站深圳今天重大事件新闻
  • wordpress建表seo搜索引擎优化怎么优化
  • 凤岗东莞微信网站建设关键词排名顾问
  • 做网站的意义是什么国外域名购买
  • php smarty 网站源码百度商家入驻怎么做
  • 炫酷业务网站百度如何免费打广告
  • 网站源码大全 最新北京排名seo
  • 大连做网站团队网站排名快速提升工具
  • 设计网站账号新闻式软文经典案例
  • 青岛wordpress建站网络营销推广的手段
  • mm131网站用什么软件做的洛阳seo博客
  • python课PPT关于web网站开发seo有哪些经典的案例
  • 沈阳酒店团购网站制作seo软件代理
  • 网站点击推广软件外包公司排名
  • 三合一网站建设是指公司推广咨询
  • 域名做网站自己的电脑seo网络推广企业