Map
特性:
和Set很像,value为null的Map就是Set。entrySet、keySet方法可以返回set集合。
Map下的HashMap、LinkedHashMap、SortedMap、TreeMap、EnumMap对应于Set的HashSet、LinkedHashSet、SortedSet、TreeSet等。
- Map的put如果重复了key,则会覆盖value,并返回被覆盖前的value。
Map重写了toString();可以返回key=xx,value=yy
重要源码:
public interface Map<K,V> {
int size();
boolean isEmpty();
//内部接口
interface Entry<K,V> {}
HashMap
特性: