privatefinal Comparator<?super K> comparator;privatetransient Entry<K,V> root;/**
* The number of entries in the tree
*/privatetransientint size =0;/**
* The number of structural modifications to the tree.
*/privatetransientint modCount =0;
构造函数
publicTreeMap(){
comparator = null;}publicTreeMap(Comparator<?super K> comparator){this.comparator = comparator;}publicTreeMap(Map<?extendsK,?extendsV> m){
comparator = null;putAll(m);}/**
* Constructs a new tree map containing the same mappings and
* using the same ordering as the specified sorted map. This
* method runs in linear time.
*/publicTreeMap(SortedMap<K,?extendsV> m){
comparator = m.comparator();try{buildFromSorted(m.size(), m.entrySet().iterator(), null, null);}catch(java.io.IOException cannotHappen){}catch(ClassNotFoundException cannotHappen){}}