Map

作者: 27b0bd2612de | 来源:发表于2017-06-16 10:56 被阅读0次

1.Map支持泛型  Map<k,v>

2.HashMap:HashMap中的Entry对象是无序排列的,key和value值都可以为null,但是一个HashMap只能有一个key为null的映射(因为key值不可重复)

声明:

public Map studnets;

public MapTest(){

this.studnets = new HashMap();

}

增:

Student student = new Student("1", "Jack");

studnets.put("1", student);

删:

改:

studnets.put(key,value);key是已存在的key。

查:

Student st = studnets.get(ID);

相关文章

网友评论

      本文标题:Map

      本文链接:https://www.haomeiwen.com/subject/iafuqxtx.html