TreeMap——由红黑树实现
package java.util; import java.io.Serializable; import java.util.function.BiConsumer; import java.util.function.BiFunction; import java.util.function.Consumer; public class TreeMap<K,V> extends AbstractMap<K,V> implements NavigableMap<K,V>, Cloneable, java.io.Serializable { private final Comparator<? super K> comparator; private transient Entry<K,V> root; private transient int size = 0; public TreeMap() { comparator = null; } public TreeMap(Comparator<? super K> comparator) { this.comparator = comparator; } static final class Entry<K,V> implements Map.Entry<K,V> { K key; V value; Entry<K,V> left; Entry<K,V> right; Entry<K,V> parent; boolean color = BLACK; // 红黑树 } }