ThinkChat2.0新版上线,更智能更精彩,支持会话、画图、阅读、搜索等,送10W Token,即刻开启你的AI之旅 广告
[TOC] TreeSet内部使用TreeMap的key列来存储数据 ## 构造函数 ~~~ public class TreeSet<E> extends AbstractSet<E> implements NavigableSet<E>, Cloneable, Serializable { private transient NavigableMap<E, Object> m; private static final Object PRESENT = new Object(); TreeSet(NavigableMap<E, Object> var1) { this.m = var1; } public TreeSet() { this((NavigableMap)(new TreeMap())); } } ~~~ ## add ~~~ public boolean add(E var1) { return this.m.put(var1, PRESENT) == null; } ~~~ ## remove ~~~ public boolean remove(Object var1) { return this.m.remove(var1) == PRESENT; } ~~~