码迷,mamicode.com
首页 > 编程语言 > 详细

Java Core - Map接口

时间:2019-04-03 21:59:37      阅读:191      评论:0      收藏:0      [点我收藏+]

标签:www.   get   lan   mic   层次结构   一个   contain   The   linked   

Map:
The java.util.Map interface represents a mapping between a key and a value.
The Map interface is not a subtype(子类型) of the Collection interface.
Therefore it behaves a bit different from the rest of the collection types.
java.util.Map接口表示键和值之间的映射。 Map接口不是Collection接口的子类型。因此它的行为与其他集合类型略有不同。
技术图片

Few characteristics of the Map Interface are:

  1. A Map cannot contain duplicate(重复的)keys and each key can map to at most one value. Some implementations(实现类) allow null key and null value like the HashMap and LinkedHashMap, but some do not like the TreeMap.Map不能包含重复的键,每个键最多可以映射一个值。一些实现允许null键和null值,如HashMap和LinkedHashMap,但有些实现类不是这样,比如TreeMap。
  2. The order of a map depends on specific implementations, e.g TreeMap and LinkedHashMap have predictable order, while HashMap does not.(未理解)
  3. There are two interfaces for implementing Map in java: Map and SortedMap, and three classes: HashMapTreeMap and LinkedHashMap.在Java中有两个用于实现Map的接口:Map和SortedMap,以及三个类:HashMap,TreeMap和LinkedHashMap。
  4. Map的层次结构如下图所示:
 技术图片

 

Java Core - Map接口

标签:www.   get   lan   mic   层次结构   一个   contain   The   linked   

原文地址:https://www.cnblogs.com/2sheep2simple/p/10651601.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!